mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-19 08:51:24 +00:00
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:
@@ -619,7 +619,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
);
|
||||
NotificationConsoleUtils.logConsoleMessage(
|
||||
ConsoleDataType.Error,
|
||||
`Error while fetching container settings for container ${this.id()}: ${JSON.stringify(error)}`
|
||||
`Error while fetching container settings for container ${this.id()}: ${error.message}`
|
||||
);
|
||||
throw error;
|
||||
}
|
||||
@@ -841,7 +841,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
collectionName: this.id(),
|
||||
defaultExperience: this.container.defaultExperience(),
|
||||
dataExplorerArea: Constants.Areas.ResourceTree,
|
||||
error: typeof error === "string" ? error : JSON.stringify(error)
|
||||
error: typeof error === "string" ? error : error.message
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -900,7 +900,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
collectionName: this.id(),
|
||||
defaultExperience: this.container.defaultExperience(),
|
||||
dataExplorerArea: Constants.Areas.ResourceTree,
|
||||
error: typeof error === "string" ? error : JSON.stringify(error)
|
||||
error: typeof error === "string" ? error : error.message
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -960,7 +960,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
collectionName: this.id(),
|
||||
defaultExperience: this.container.defaultExperience(),
|
||||
dataExplorerArea: Constants.Areas.ResourceTree,
|
||||
error: typeof error === "string" ? error : JSON.stringify(error)
|
||||
error: typeof error === "string" ? error : error.message
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -1157,7 +1157,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
},
|
||||
error => {
|
||||
record.numFailed++;
|
||||
record.errors = [...record.errors, JSON.stringify(error)];
|
||||
record.errors = [...record.errors, error.message];
|
||||
return Q.resolve();
|
||||
}
|
||||
);
|
||||
@@ -1210,7 +1210,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
(error: any) => {
|
||||
Logger.logError(
|
||||
JSON.stringify({
|
||||
error: JSON.stringify(error),
|
||||
error: error.message,
|
||||
accountName: this.container && this.container.databaseAccount(),
|
||||
databaseName: this.databaseId,
|
||||
collectionName: this.id()
|
||||
|
||||
@@ -103,7 +103,7 @@ export default class Database implements ViewModels.Database {
|
||||
);
|
||||
NotificationConsoleUtils.logConsoleMessage(
|
||||
ConsoleDataType.Error,
|
||||
`Error while fetching database settings for database ${this.id()}: ${JSON.stringify(error)}`
|
||||
`Error while fetching database settings for database ${this.id()}: ${error.message}`
|
||||
);
|
||||
throw error;
|
||||
}
|
||||
@@ -239,7 +239,7 @@ export default class Database implements ViewModels.Database {
|
||||
(error: any) => {
|
||||
Logger.logError(
|
||||
JSON.stringify({
|
||||
error: JSON.stringify(error),
|
||||
error: error.message,
|
||||
accountName: this.container && this.container.databaseAccount(),
|
||||
databaseName: this.id(),
|
||||
collectionName: this.id()
|
||||
|
||||
@@ -158,7 +158,7 @@ export default class StoredProcedure {
|
||||
sprocTab.onExecuteSprocsResult(result, result.scriptLogs);
|
||||
},
|
||||
(error: any) => {
|
||||
sprocTab.onExecuteSprocsError(JSON.stringify(error));
|
||||
sprocTab.onExecuteSprocsError(error.message);
|
||||
}
|
||||
)
|
||||
.finally(() => {
|
||||
|
||||
Reference in New Issue
Block a user