braintree / braintree_php

Braintree PHP library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
546 stars 224 forks source link

Serialize validation errors to JSON #256

Closed sebdesign closed 4 years ago

sebdesign commented 5 years ago

Summary

While the Result\Error object implements the JsonSerializable interface, the errors key is currently JSON encoded as an empty object. This PR allows the ErrorCollection object to serialize all the validation errors as JSON.

This can be quite valuable for logging and debugging, e.g. when the Result\Error is passed as context of the Monolog logger.

Checklist

hollabaq86 commented 5 years ago

Hi @sebdesign, thanks for the PR! We noticed there isn't any test coverage for this change, could I trouble you to add that?

sebdesign commented 5 years ago

Sure I'll add some tests!

tabathapictou commented 4 years ago

👌