Browse Source

Explore: improve error handling

David Kaltschmidt 7 years ago
parent
commit
15eb3bb2f8
1 changed files with 7 additions and 1 deletions
  1. 7 1
      public/app/features/explore/Explore.tsx

+ 7 - 1
public/app/features/explore/Explore.tsx

@@ -735,7 +735,7 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
 
     console.error(response);
 
-    let error: string | JSX.Element = response;
+    let error: string | JSX.Element;
     if (response.data) {
       if (typeof response.data === 'string') {
         error = response.data;
@@ -752,6 +752,12 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
       } else {
         throw new Error('Could not handle error response');
       }
+    } else if (response.message) {
+      error = response.message;
+    } else if (typeof response === 'string') {
+      error = response;
+    } else {
+      error = 'Unknown error during query transaction. Please check JS console logs.';
     }
 
     this.setState(state => {