inpsyde / modularity

A PSR-11 implementation for WordPress Plugins, Themes or Libraries.
https://inpsyde.github.io/modularity/
GNU General Public License v2.0
44 stars 4 forks source link

Exceptions #32

Closed esurov closed 4 months ago

esurov commented 1 year ago

Instead of using \Exception for everything we'd like to distinguish different exceptions by name.

Not only it better matches the PSR-11 being implemented in subject, but also it improves the code testability. Instead of parsing the exception message we can better control the exception class.

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

It improves the exception handling by introducing the named exceptions and improving the tests.

What is the current behavior? (You can also link to an open issue here)

Currently \Exception class is used everywhere. Instead we want to use named exception.

What is the new behavior (if this is a feature change)?

Code structure and tests quality improved.

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

No.

Other information:

esurov commented 1 year ago

Thanks for your comments gentlemen @gmazzap @shvlv ! 👍

Chrico commented 4 months ago

First of all: Really big thanks for the work you invested. ☕ But, this PR is sitting now for a while and I'm going to close it. We're not going to implement custom Exception classes for this package.