loopbackio / loopbackio/strong-error-handler

Support custom jsonSerializer

Open
#8 0 comments 0 reactions 1 assignee View on GitHub

@davidcheung is already working on this.

Since May 12, 2016.

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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.