Seems that hierarchical error handling works..
TreeTable component seems to work too. Edit is half-way through. Create / delete are TBD.
This commit is contained in:
parent
79ea9e1897
commit
5e4c86f626
24 changed files with 9967 additions and 261 deletions
44
shared/interoperable-errors.js
Normal file
44
shared/interoperable-errors.js
Normal file
|
@ -0,0 +1,44 @@
|
|||
'use strict';
|
||||
|
||||
class InteroperableError extends Error {
|
||||
constructor(type, msg, data) {
|
||||
super(msg);
|
||||
this.type = type;
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
|
||||
class NotLoggedInError extends InteroperableError {
|
||||
constructor(msg, data) {
|
||||
super('NotLoggedIn', msg, data);
|
||||
}
|
||||
}
|
||||
|
||||
class ChangedError extends InteroperableError {
|
||||
constructor(msg, data) {
|
||||
super('ChangedError', msg, data);
|
||||
}
|
||||
}
|
||||
|
||||
class NotFoundError extends InteroperableError {
|
||||
constructor(msg, data) {
|
||||
super('NotFoundError', msg, data);
|
||||
}
|
||||
}
|
||||
|
||||
const errorTypes = {
|
||||
InteroperableError,
|
||||
NotLoggedInError,
|
||||
ChangedError,
|
||||
NotFoundError
|
||||
};
|
||||
|
||||
function deserialize(errorObj) {
|
||||
if (errorObj.type) {
|
||||
return new errorTypes[errorObj.type](errorObj.message, errorObj.data)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Object.assign({}, errorTypes, {
|
||||
deserialize
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue