Skip to content

Commit

Permalink
revert Run error to raw json and simplify Explain error (#889)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcui1225 authored Dec 4, 2020
1 parent 41d48dc commit 5cea8b4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 29 deletions.
11 changes: 1 addition & 10 deletions workbench/public/components/Main/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,6 @@ export class Main extends React.Component<MainProps, MainState> {
};
}

formatQueryErrorBody(data: any) {
let prettyErrorMessage = "";
prettyErrorMessage += 'reason: ' + data.errorReason + '\n';
prettyErrorMessage += 'details: ' + data.errorDetails + '\n';
prettyErrorMessage += 'type: ' + data.errorType + '\n';
prettyErrorMessage += 'status: ' + data.status;
return prettyErrorMessage;
}

processQueryResponse(response: IHttpResponse<ResponseData>): ResponseDetail<string> {
if (!response) {
return {
Expand All @@ -270,7 +261,7 @@ export class Main extends React.Component<MainProps, MainState> {
return {
fulfilled: false,
errorMessage: response.data.resp,
data: this.formatQueryErrorBody(response.data),
data: response.data.body,
};
}

Expand Down
8 changes: 1 addition & 7 deletions workbench/public/components/PPLPage/PPLPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,9 @@ export class PPLPage extends React.Component<PPLPageProps, PPLPageState> {
return false;
}

const showExplainErrorMessage = () => {
return this.props.pplTranslations.map((queryTranslation: any) => JSON.stringify(
queryTranslation.errorMessage + ": This query is not explainable.", null, 2
));
}

const explainContent = pplTranslationsNotEmpty()
? this.props.pplTranslations.map((queryTranslation: any) => JSON.stringify(queryTranslation.data, null, 2)).join("\n")
: showExplainErrorMessage();
: 'This query is not explainable.';

let modal;

Expand Down
8 changes: 1 addition & 7 deletions workbench/public/components/SQLPage/SQLPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,9 @@ export class SQLPage extends React.Component<SQLPageProps, SQLPageState> {
return false;
}

const showExplainErrorMessage = () => {
return this.props.sqlTranslations.map((queryTranslation: any) => JSON.stringify(
queryTranslation.errorMessage + ": This query is not explainable.", null, 2
));
}

const explainContent = sqlTranslationsNotEmpty()
? this.props.sqlTranslations.map((queryTranslation: any) => JSON.stringify(queryTranslation.data, null, 2)).join("\n")
: showExplainErrorMessage();
: 'This query is not explainable.';

let modal;

Expand Down
6 changes: 1 addition & 5 deletions workbench/server/services/QueryService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,11 @@ export default class QueryService {
};
} catch (err) {
console.log(err);
const errorObj = JSON.parse(err.body);
return {
data: {
ok: false,
resp: err.message,
errorReason: errorObj.error.reason,
errorDetails: errorObj.error.details,
errorType: errorObj.error.type,
status: errorObj.status
body: err.body
},
};
}
Expand Down

0 comments on commit 5cea8b4

Please sign in to comment.