cubicmushroom / exceptions
A basic, abstract exceptions class
Requires
- php: >= 5.4
Requires (Dev)
- codeception/codeception: ~2.0
This package is not auto-updated.
Last update: 2024-11-09 17:58:49 UTC
README
Cubic Mushroom Exceptions
This library provides just a single abstract exception class with it's own bild() method for easily creating exceptions with various properties, passed as an array of arguments.
How to use
Just have a look at the src/CubicMushroom/Exceptions/AbstractException
class methods for basic methods, but here is a
brief overview...
AbstractException
provides build()
method that can be used to prepare exceptions to be thrown.
When using build()
, you don't need to pass in a $message, $code. If you don't the default for the class will be
used. This is returned by the classes getDefaultMessage()
and getDefaultCode()
methods, if they exist.
As it's not helpful when an exception doesn't have a message, if no message is either passed, or a default set in the
exception class, a MissingExceptionMessageException
will be thrown.
The build()
method also accepts a second array parameter. If passed, the build()
method will attempt to set all the
properties on the build exception using the setter for the property. If the setter is not found, then a
SetterNotFoundException
will be thrown.
Roadmap
- Add way of defining required additional parameters
- More stuff, as I think of it