exports.UserError = class extends Error { constructor(message) { super(message); this.name = 'UserError'; 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; };