2018-01-29 11:37:54 +00:00
|
|
|
|
|
|
|
exports.UserError = class extends Error {
|
|
|
|
constructor(message) {
|
|
|
|
super(message);
|
2018-08-02 07:49:00 +00:00
|
|
|
this.name = 'UserError';
|
2018-01-29 11:37:54 +00:00
|
|
|
this.statusCode = 400;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.getFinalState = function(ctx) {
|
|
|
|
if (ctx.isNewInstance)
|
|
|
|
return ctx.instance;
|
|
|
|
if (ctx.currentInstance)
|
|
|
|
return Object.assign({},
|
|
|
|
ctx.currentInstance.__data,
|
|
|
|
ctx.data || ctx.instance
|
|
|
|
);
|
|
|
|
|
|
|
|
return null;
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.isMultiple = function(ctx) {
|
|
|
|
return !ctx.isNewInstance && !ctx.currentInstance;
|
|
|
|
};
|