Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
get (id, params) {
if (params.query.error) {
throw new Error('Something went wrong');
}
if (params.query.feathersError) {
throw new errors.NotAcceptable('This is a Feathers error', { data: true });
}
return super.get(id, params)
.then(data => {
const result = Object.assign({ query: params.query }, data);
if (params.authorization) {
result.authorization = params.authorization;
}
return result;
});
}
break;
case 403:
feathersError = new errors.Forbidden(error);
break;
case 404:
feathersError = new errors.NotFound(error);
break;
case 405:
feathersError = new errors.MethodNotAllowed(error);
break;
case 406:
feathersError = new errors.NotAcceptable(error);
break;
case 408:
feathersError = new errors.Timeout(error);
break;
case 409:
feathersError = new errors.Conflict(error);
break;
case 422:
feathersError = new errors.Unprocessable(error);
break;
case 501:
feathersError = new errors.NotImplemented(error);