mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
Explore: Show logging errors from backend
- Logging datasource sends error string directly in the message body - allowing response body to be an error when query transaction failed - added throw in case we ever encounter unhandled errors again (forces us to fix the issue)
This commit is contained in:
parent
088c2e70d8
commit
47468fca68
@ -727,6 +727,9 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
|
||||
|
||||
let error: string | JSX.Element = response;
|
||||
if (response.data) {
|
||||
if (typeof response.data === 'string') {
|
||||
error = response.data;
|
||||
} else if (response.data.error) {
|
||||
error = response.data.error;
|
||||
if (response.data.response) {
|
||||
error = (
|
||||
@ -736,6 +739,9 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
|
||||
</>
|
||||
);
|
||||
}
|
||||
} else {
|
||||
throw new Error('Could not handle error response');
|
||||
}
|
||||
}
|
||||
|
||||
this.setState(state => {
|
||||
|
Loading…
Reference in New Issue
Block a user