Replies: 1 comment 1 reply
-
Hm, i doubt as for the other exceptions, PSL functions should only throw exceptions from within it's component namespace, and each component should contain it's own ExceptionInterface that extends the base ExceptionInterface, so you can catch |
Beta Was this translation helpful? Give feedback.
-
Take following example:
This function can throw 3 different types of exceptions:
InvalidPattern
: It can indeed throw that, but that should (preferably) not happen outside of development.RuntimeExcetion
: shit happens ...InvariantViolantionException
: This can happen based on the limit attribute.Now if I want to use the split function inside my code, I need to add a supress for both invalid pattern and invariant violation, since it does not apply to me.
Most of the time, I am only interested in dealing with the
RuntimeException
.The other errors are mostly things that occur during development, but don't really need to buble upstream.
The 3 exceptions don't really have a main interface outside the most generic
Psl\Exception\ExceptionInterface
.I don't really have an answer to this problem, so is there something we could do about this from your perspective?
What would be nice - but maybe out of scope for this project is:
@throws-if $limit <= 0 InvariantViolantionException
Beta Was this translation helpful? Give feedback.
All reactions