dhii/exception

Standards-compliant exception classes

v0.1-alpha5 2018-04-02 15:18 UTC

This package is auto-updated.

Last update: 2024-12-07 05:34:18 UTC


README

Build Status Code Climate Test Coverage Latest Stable Version This package complies with Dhii standards

Standards-compliant exception classes.

Details

This package contains concrete implementations of classes that implement interfaces in dhii/exception-interface. This provides developers with ready-made, standards-compliant classes that can be safely instantiated and thrown to signal the various errors. The concrete exceptions will usually have a corresponding factory trait, and the factory methods of those traits are the recommended way of creating new exception instances (after service definition, of course).

Implementations in this package also have the following features aimed to become more standards-compliant:

  • A stringable is accepted everywhere, where a string can be passed.
  • All parameters can be passed null to signal default value (which may be not null).

Consumers, i.e. code that attempts to catch, should not depend on these classes. Instead, consumers should depend on the interfaces of dhii/exception-interface.

Creating New Exceptions

Sometimes, there is a need to create a new exception class, such as to implement a new standard (like dhii/action-interface), or perhaps to implement two unrelated interfaces (imagine an object that implements both Dhii\Action\ActionInterface and Mouf\Utils\Action\ActionInterface). In this case, implementing some of the features of Dhii exceptions may take an un-necessarily long time. This package provides a way to make creating new exceptions faster.