vandium-io / vandium-node

AWS Lambda framework for building functions using Node.js for API Gateway, IoT applications, and other AWS events.
BSD 3-Clause "New" or "Revised" License
386 stars 30 forks source link

Custom error format on api().processError in v4+ #40

Closed dkreuer closed 5 years ago

dkreuer commented 5 years ago

Is it possible to have custom error format? I need to have error responses in https://tools.ietf.org/html/rfc7807 (Problem Details for HTTP apis) format. This is possible for the actual handlers (GET, POST, ...) by catching errors and handling by myself but is not possible for validation errors (additionally validation stops at first error, it would be nice to validate the whole event and return all validation errors).

Maybe a property error.body which can be generated by the onError hook which will be used instead of generating the body object in processError is sufficient?

richardhyatt commented 5 years ago

Implemented in 4.9.0