loopbackio / loopbackio/strong-error-handler
Support custom jsonSerializer
@davidcheung is already working on this.
Since May 12, 2016.
- Dominant language
- JavaScript
- Stars
- 38
- Forks
- 36
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 11
Description
See https://github.com/strongloop/loopback/issues/1650#issuecomment-161920555
> ``` js
> // a custom JSON serializer function for producing JSON response bodies
> // @param sanitizedData: response data containing only safe properties
> // @param originalError: the original Error object
> jsonSerializer: function(sanitizedData, originalError) {
> if (originalError.name === 'ValidationError') {
> var details = sanitizedData.details || {};
> sanitizedData.issueCount = details.codes && Object.keys(details.codes).length;
> }
> return sanitizedData;
> }
> ```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.