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:
David Kaltschmidt 2018-11-30 16:09:56 +01:00
parent 088c2e70d8
commit 47468fca68

View File

@ -727,14 +727,20 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
let error: string | JSX.Element = response; let error: string | JSX.Element = response;
if (response.data) { if (response.data) {
error = response.data.error; if (typeof response.data === 'string') {
if (response.data.response) { error = response.data;
error = ( } else if (response.data.error) {
<> error = response.data.error;
<span>{response.data.error}</span> if (response.data.response) {
<details>{response.data.response}</details> error = (
</> <>
); <span>{response.data.error}</span>
<details>{response.data.response}</details>
</>
);
}
} else {
throw new Error('Could not handle error response');
} }
} }