You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thanks so much for psysh, it is absolutely fundamental to my development process these days as im sure it is for many others.
Suggestion / request for comment
It would be nice to be able to specify a custom error formatter (e.g., closure) which receives the exception/throwable, and the output instance as arguments. Either a custom formatter, or at least the ability to hook into the Shell::writeException() method and e.g., write additional output to aid debugging for certain types of errors.
One example of this is in laravel projects, when a validation exception is thrown. Psysh outputs the error message, but the real substance of those exceptions is the $e->errors() array, which contains the exact validation errors which is crucial for debugging.
To demonstrate, this is the current behaviour:
What I'm aiming to be able to achieve:
Obviously there are myriad ways this could be achieved, i have a couple of ideas of how to implement a custom formatter as an optional configuration option in a safe/sensible way and am willing to prepare a PR, if this is an addition you'd be welcome to seeing in the project.
Thanks
The text was updated successfully, but these errors were encountered:
Conceptually this feels in line with the way we use var-dumper and casters. I could get on board with it.
It'd be ideal if we could come up with a way for this to work and be useful without needing additional configuration, and without duplicating a bunch of stuff already done in var-dumper. Maybe using var-dumper automatically if there's an explicitly defined caster for that exception type? Maybe doing something with caster filters, and extending our Presenter with a presentException?
Hi!
First of all, thanks so much for psysh, it is absolutely fundamental to my development process these days as im sure it is for many others.
Suggestion / request for comment
It would be nice to be able to specify a custom error formatter (e.g., closure) which receives the exception/throwable, and the output instance as arguments. Either a custom formatter, or at least the ability to hook into the Shell::writeException() method and e.g., write additional output to aid debugging for certain types of errors.
One example of this is in laravel projects, when a validation exception is thrown. Psysh outputs the error message, but the real substance of those exceptions is the $e->errors() array, which contains the exact validation errors which is crucial for debugging.
To demonstrate, this is the current behaviour:
What I'm aiming to be able to achieve:
Obviously there are myriad ways this could be achieved, i have a couple of ideas of how to implement a custom formatter as an optional configuration option in a safe/sensible way and am willing to prepare a PR, if this is an addition you'd be welcome to seeing in the project.
Thanks
The text was updated successfully, but these errors were encountered: