Extend elefrant errors and create your own type of errors.
$ elefrant install elefrant-custom-errorsActivate the component.
Create your own type of error. Add the new type in lib/errors.js from the component folder.
functionMyNewError(message){restify.RestError.call(this,{restCode: 'MyNewError',statusCode: 418,message: message,constructorOpt: MyNewError});}registerError(restify,'RestError',MyNewError,'MyNewError');###Orm
Format ORM errors and validation.
Add to models a new attribute validationMessages:
...
attributes: {name: {type: 'string',required: true,unique: true,index: true}},
...
validationMessages : {name: {required: 'Name is required',}}...And then usage in controller:
next(newrestify.OrmError(error,MyModel.validationMessages));```
## LicenseMIT©[Elefrant](http://elefrant.com/#/license)