Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors other than Application::ERROR_EXCEPTION are missed #1

Open
juriansluiman opened this issue Mar 30, 2013 · 0 comments
Open

Errors other than Application::ERROR_EXCEPTION are missed #1

juriansluiman opened this issue Mar 30, 2013 · 0 comments
Assignees
Labels
Milestone

Comments

@juriansluiman
Copy link
Owner

Both default error listeners are disabled by the module, but the one now enabled listens only to Application::ERROR_EXCEPTION. There must be a way to connect the other errors to marker interfaces:

ERROR_CONTROLLER_CANNOT_DISPATCH
ERROR_CONTROLLER_NOT_FOUND
ERROR_CONTROLLER_INVALID
ERROR_EXCEPTION
ERROR_ROUTER_NO_MATCH

Suggestion is to map these error codes to a special marker interface. The control structure is then:

$exception = $e->getParam('exception');
if ($exception instanceof Exception\ExceptionInterface) {
    // Continue with interface from $exception
}

$error = $e->getError();
if (array_key_exists($error, $this->applicationErrors)) {
    // Continue with marker attached to error code
}

// Continue with default marker

In case the $exception is not a registered marker interface, the code checks again the error type of the event and as last sets it as default marker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant