thephpleague/booboo

Showing exception codes in formatters ?

Closed this issue · 2 comments

There are occasions where the same exception class is used in different occasions with a different "code" argument (e.g. Exception::getCode()). It will be nice if this is included when rendering with the formatters when this code is different than zero (its default value). I understand that the backtrace can guide you very easily to where the exception was thrown, but there are also occasions (such as when logging the errors/exception) that it will be easier just to be able to read the exception code along with exception message

And if the developer of a library uses codes to identify exceptions and such, it could become very handy to do so, no ?

I agree. Sometimes the same exception might be used with different codes. Being able to identify the exception by code can be important.