feat(validation): include error messages in ValidationFailed exception message#2203
Conversation
|
I don't think this is the right thing to do, honestly. Appending the JSON-encoded message array seems rough around the edges. In what situations did you need the |
|
I've reworked it to do two things:
|
|
Right, didn't take a look at the original issue, thanks @mgalexandre @brendt, in what situations do you need the message to contain the actual errors? I do think the context, as suggested by Neo, is more suited here |
|
Thanks, yeah that's definitely and issue. Then I believe our exception renderer should be responsible for that instead of hijacking the exception message. Maybe by showing the context for all exceptions, or by special-casing |
|
Right but I don't think this is using an exception renderer? It's just PHPUnit showing the exception output during testing — AFAIK |
|
Ah, my bad, somehow thought this was our console exception renderer... yeah, not much we can do here if you want to use |
|
@mgalexandre can you run |
|
sorry, missed it! it's done :) |
|
Thank you :) |

1. Implements
ProvidesContext, exposing the errors as structured context, so they show up in log context viaLoggingExceptionReporterand on the development exception page, the same pattern asQueryWasInvalid,EncryptionFailed, andProcessExecutionWasForbidden.2. Appends the failures to the message in a human-readable format:
The message stays untouched (
Validation failed.) when there are no error messages.Fixes #2189