Closed pauloimon closed 1 year ago
I'm not sure we want to accept exceptions without exceptions(?).
@Glennmen @SebastiaanKloos What do you think?
Could you give an example when this would happen 🤔 I don't see any reason why it would be empty.
I agree with you. Exceptions must always have a message.
But I found it when I was testing the package and to me it seemed make no sense ignore them because of that.
I know that the messages are used as log titles on LaraBug Dashboard, but why we can't add a default value instead of ignore them?
A better approach would be use the exception types as default value:
$data['exception'] = $exception->getMessage() ?? get_class($exception);
You can close this PR if this make no sense to LaraBug business rules.
@SebastiaanKloos I think this one is ready to be merged right?
@SebastiaanKloos I think this one is ready to be merged right?
Yes! Thanks @pauloimon 🙏
Sometimes, when the package is sending Exceptions to LaraBug API, it returns the HTTP error
422
due to empty message on them.Steps to reproduce
Just throw an Exception with no message on anywhere in your code:
And now capture the error on line
94/95
of./src/LaraBug.php
file like this:The LaraBug API will return:
Solution
I added a Null Coalescing operator on
getExceptionData()
to fill the Exception's message with a default value if not exists.