Skip to content

Commit

Permalink
#627: handle errors during async delete op
Browse files Browse the repository at this point in the history
  • Loading branch information
JoernBerkefeld committed Jan 16, 2023
1 parent ff88f76 commit 0f88a94
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/metadataTypes/MetadataType.js
Original file line number Diff line number Diff line change
Expand Up @@ -1647,7 +1647,7 @@ class MetadataType {
const keyObj = {};
keyObj[this.definition.keyField] = key;
try {
this.client.rest.delete(url);
await this.client.rest.delete(url);
if (!handleOutside) {
Util.logger.info(`- deleted ${this.definition.type}: ${key}`);
}
Expand All @@ -1658,10 +1658,7 @@ class MetadataType {
if (handleOutside) {
throw ex;
} else {
const errorMsg = ex?.results?.length
? `${ex.results[0].StatusMessage} (Code ${ex.results[0].ErrorCode})`
: ex.message;
Util.logger.error(`- error deleting ${this.definition.type} '${key}': ${errorMsg}`);
Util.logger.errorStack(ex, ` - Deleting ${this.definition.type} '${key}' failed`);
}

return false;
Expand Down

0 comments on commit 0f88a94

Please sign in to comment.