Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/WebFiori/err
Browse files Browse the repository at this point in the history
  • Loading branch information
usernane committed Jun 26, 2024
2 parents 64fcb9f + 6182d8f commit 0c46a4d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ namespace webfiori\error;
class DefaultExceptionsHandler extends AbstractExceptionHandler {
public function __construct() {
parent::__construct();

//Set handler name. Each registered handler must have a unique name.
$this->setName('Cool Handler');

//Sets the priority of the handler. Larger means that it has higher priority.
$this->setPriority(100);
}
/**
* Handles the exception.
Expand Down Expand Up @@ -89,10 +95,10 @@ class DefaultExceptionsHandler extends AbstractExceptionHandler {

### Setting a Custom Exceptions Handler

After implementing the handler, the developer must set it as exceptions handler. To do that, simply the developer have to use the method `Handler::setHandler()` in any place in his source code.
After implementing the handler, the developer must set it as exceptions handler. To do that, simply the developer have to use the static method `Handler::registerHandler()` in any place in his project.

``` php
Handler::setHandler(new DefaultExceptionsHandler());
Handler::registerHandler(new DefaultExceptionsHandler());
```


0 comments on commit 0c46a4d

Please sign in to comment.