Better handling of persistence errors (#5576)

* conflict errors in particular
This commit is contained in:
Andrew Henry
2022-07-29 14:29:34 -07:00
committed by GitHub
parent 60f20c64d5
commit 22924f18fc
3 changed files with 57 additions and 9 deletions

View File

@@ -230,6 +230,7 @@ export default class ObjectAPI {
return result;
}).catch((result) => {
console.warn(`Failed to retrieve ${keystring}:`, result);
this.openmct.notifications.error(`Failed to retrieve object ${keystring}`);
delete this.cache[keystring];
@@ -387,7 +388,13 @@ export default class ObjectAPI {
}
}
return result;
return result.catch((error) => {
if (error instanceof this.errors.Conflict) {
this.openmct.notifications.error(`Conflict detected while saving ${this.makeKeyString(domainObject.identifier)}`);
}
throw error;
});
}
/**