Fix error handling in DE (#294)

- Replaced `JSON.stringify(error)` with `error.message`
- Created `ErrorHandlingUtils` and moved all error logging actions in there
This commit is contained in:
victor-meng
2020-10-21 14:28:30 -07:00
committed by GitHub
parent e09730d782
commit 24b5b754ca
46 changed files with 187 additions and 265 deletions

View File

@@ -70,8 +70,7 @@ export class BrowseQueriesPane extends ContextualPaneBase {
},
startKey
);
this.formErrors("Failed to setup a collection for saved queries");
this.formErrors(`Failed to setup a collection for saved queries: ${JSON.stringify(error)}`);
this.formErrors(`Failed to setup a collection for saved queries: ${error.message}`);
} finally {
this.isExecuting(false);
}

View File

@@ -82,7 +82,7 @@ export class RenewAdHocAccessPane extends ContextualPaneBase {
this.container
.renewShareAccess(this.accessKey())
.fail((error: any) => {
const errorMessage: string = JSON.stringify(error);
const errorMessage: string = error.message;
NotificationConsoleUtils.logConsoleMessage(ConsoleDataType.Error, `Failed to connect: ${errorMessage}`);
this.formErrors(errorMessage);
this.formErrorsDetails(errorMessage);

View File

@@ -88,7 +88,7 @@ export class SaveQueryPane extends ContextualPaneBase {
(error: any) => {
this.isExecuting(false);
if (typeof error != "string") {
error = JSON.stringify(error);
error = error.message;
}
this.formErrors("Failed to save query");
this.formErrorsDetails(`Failed to save query: ${error}`);
@@ -143,7 +143,7 @@ export class SaveQueryPane extends ContextualPaneBase {
startKey
);
this.formErrors("Failed to setup a container for saved queries");
this.formErrors(`Failed to setup a container for saved queries: ${JSON.stringify(error)}`);
this.formErrors(`Failed to setup a container for saved queries: ${error.message}`);
} finally {
this.isExecuting(false);
}

View File

@@ -85,7 +85,7 @@ export class SetupNotebooksPane extends ContextualPaneBase {
"Successfully created a default notebook workspace for the account"
);
} catch (error) {
const errorMessage = typeof error == "string" ? error : JSON.stringify(error);
const errorMessage = typeof error == "string" ? error : error.message;
TelemetryProcessor.traceFailure(
Action.CreateNotebookWorkspace,
{