Handle error objects with an 'errors' object

This repository was archived by the owner on Aug 29, 2018. It is now read-only.

This repository was archived by the owner on Aug 29, 2018. It is now read-only.

@ekryski

Description

@ekryski

Mongoose returns errors that have an errors array in validation. It's generally a pretty nice pattern, especially for client side error handling:

{
    message: 'Validation failed',
    name: 'ValidationError',
    errors: { 
      lastName: {
        message: 'Path `lastName` is required.',
        name: 'ValidatorError',
        path: 'lastName',
        type: 'required',
        value: undefined
      }
   }
}

Metadata

Metadata

Labels

Development

No branches or pull requests

Issue actions