为mongoosevalidation设置错误代码

我正在使用mongoosevalidation来validation我的模型。 例如:

var some_schema = new Schema({ title: { type : [String, 'title must be string'], required: [true, 'title is required'] } }) 

此架构具有自定义错误消息,我也想设置自定义错误代码