loopbackio / loopbackio/strong-error-handler

Support custom jsonSerializer

Open
#8 0 comments 0 reactions 1 assignee Claimed by @davidcheung View on GitHub
feature help wanted needs-priority
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.