loopbackio / loopbackio/strong-error-handler
Support custom jsonSerializer
@davidcheung đang làm issue này rồi.
Từ ngày 12/5/2016.
- Ngôn ngữ chính
- JavaScript
- Star
- 38
- Fork
- 36
- Merge trung bình
- 1 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 11
Mô tả
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;
> }
> ```
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Đánh giá
Issue này chưa được đánh giá.