JsonFormatter outputs invalid JSON with multiple errors
Closed this issue · 1 comments
shadowhand commented
When multiple errors are triggered within the context of a single page, the output renders as:
{"message": "..."}{"message": "..."}
This is obviously invalid JSON and will not validate or convert properly. Expected output could be:
{"errors": [{"message": "..."}, {"message": "..."}]}
While it is not entirely obvious to me how this would be implemented, some kind of handler "before" and "after" method should make it possible to break it up as:
$before = '{"errors": [';
$after = ']}';
brandonsavage commented
The way that BooBoo works, it handles each error individually. I recommend using the blocking feature built into the runner:
$booboo = new Runner();
$booboo->treatErrorsAsExceptions(true);