Work in progress on a React-based error reporting mechanism.
The idea is that REST handlers always fail with throwing an Error (subclass of InteroperableError). The InteroperableError contains type and data field which are JSON-serialized and sent to client. It's up to the client to interpret the error and choose an appropriate way to present it.
This commit is contained in:
parent
4504d539c5
commit
79ea9e1897
10 changed files with 304 additions and 142 deletions
|
@ -3,15 +3,15 @@
|
|||
const knex = require('../knex');
|
||||
const hasher = require('node-object-hash')();
|
||||
const { filterObject } = require('../helpers');
|
||||
const InteroperableError = require('../InteroperableError');
|
||||
const interoperableErrors = require('../interoperable-errors');
|
||||
|
||||
class ChangedError extends InteroperableError {
|
||||
class ChangedError extends interoperableErrors.InteroperableError {
|
||||
constructor(msg, data) {
|
||||
super('namespaces.ChangedError', msg, data);
|
||||
}
|
||||
}
|
||||
|
||||
class NotFoundError extends InteroperableError {
|
||||
class NotFoundError extends interoperableErrors.InteroperableError {
|
||||
constructor(msg, data) {
|
||||
super('namespaces.NotFoundError', msg, data);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue