Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
case '23':
feathersError = new errors.BadRequest(message);
break;
case '28':
feathersError = new errors.Forbidden(message);
break;
case '3D':
case '3F':
case '42':
feathersError = new errors.Unprocessable(message);
break;
default:
feathersError = new errors.GeneralError(message);
break;
}
} else if (!(error instanceof errors.FeathersError)) {
feathersError = new errors.GeneralError(message);
}
feathersError[ERROR] = error;
throw feathersError;
};
const FeathersSequelize = require('feathers-sequelize');
const errors = require('@feathersjs/errors');
const logger = require('winston');
class NotModified extends errors.FeathersError {
constructor(message, data) {
super(message, 'not-modified', 304, 'NotModified', data);
}
}
/*
* This class exist mostly as a wrapper around the feathers-sequelize service
* for the Update model.
*/
class Update extends FeathersSequelize.Service {
constructor(options) {
super(options);
this.app = options.app;
/*
function errorHandler (error, id) {
if (error instanceof errors.FeathersError) {
throw error;
}
const statusCode = error.statusCode;
if (statusCode === 404 && id !== undefined) {
throw new errors.NotFound(`No record found for id '${id}'`);
}
if (errors[statusCode]) {
throw new errors[statusCode](error.message, error);
}
throw new errors.GeneralError(error.message, error);
}