Permalink
Browse files

fix(rest): Use err.data.response if exists as message

  • Loading branch information...
mvrueden committed Aug 28, 2017
1 parent 0c2b6f4 commit 4875b9c3d9e4dbd20c95831937fff85d6946a663
Showing with 6 additions and 6 deletions.
  1. +6 −6 src/rest/GrafanaHTTP.ts
View
@@ -126,12 +126,12 @@ export class GrafanaHTTP extends AbstractHTTP {
* @hidden
*/
protected handleError(err: any, options?: any): never {
let message = AbstractHTTP.extractMessage(err);
const status = AbstractHTTP.extractStatus(err);
if (!status) {
message = 'An unknown error has occurred: ' + message;
}
throw new GrafanaError(message, status, options, err);
let message = AbstractHTTP.extractMessage(err);
if (err && err.data && err.data.response && (typeof (err.data.response) === 'string')) {
message = err.data.response;
}
const status = AbstractHTTP.extractStatus(err);
throw new GrafanaError(message, status, options, err);
}
/**

0 comments on commit 4875b9c

Please sign in to comment.