ThrowableProxy |
Throwables were designed to handle exceptional states that can occur in application during execution. They were not
meant to be used in business logic, however in practice, many design patterns emerged that used Throwables as a type
representation of failure, for which application needed to react. In other programming languages Throwables are
populated with data not on creation but while throwing. In PHP it works differently, and Throwables are populated
on creation. This can lead to major problems with memory and performance with usage of previously mentioned design
patterns. In those cases the valuable pieces of information are Throwable class, message, code and previous element,
but not stack trace that requires most of memory allocation. For this exclusive need ThrowableProxy has been created. |