Hi,
I'm trying to intercept errors and exceptions following this example: https://github.com/phalcon/incubator/blob/master/Library/Phalcon/Error/
Unfortunately, I fail :(
-
I'm registering the ErrorHandler in the Module.php of the module I want to intercept errors on.
class Module implements ModuleDefinitionInterface { public function __construct() { ErrorHandler::register(true); // I have stripped the ENV_... stuff out of the plugin and pass a "debug" option here }
The autoloader is set up correctly, the register-method is executed.
Debugging in Handler.php I can see the $dispatcher object is also set up correctly if an error occurs (taken before $dispatcher->dispatch();):
$dispatcher = {Phalcon\Msv\Dispatcher} [17]
_dependencyInjector = {Phalcon\DI\FactoryDefault} [4]
_eventsManager = {Phalcon\Events\Manager}
_activeHandler = {MobileProject\Frontend\Controllers\PublicController} [2]
_finished = true
_forwarded = false
_moduleName = "frontend"
_namespaceName = "MobileProject\Frontend\Controllers"
_handlerName = "error"
_actionName = "phpError"
_params = {array} [1]
_returnedValue = null
_lastHandler = null
_defaultNamespace = null
_actionSuffix = "Action"
_handlerSuffix = "Controller"
_defaultHandler = "index"
_defaultAction = "index"
So I want to execute the phpErrorAction in ErrorController - but:
Fatal error: Call to undefined function MobileProject\Frontend\Controllers\scnidsdah() in /var/www/phalcon/apps/frontend/controllers/PublicController.php on line 15
Fatal error: Uncaught exception 'Phalcon\Mvc\Dispatcher\Exception' with message 'MobileProject\Frontend\Controllers\IndexController handler class cannot be loaded' in /var/www/phalcon/library/Phalcon/Error/Handler.php on line 123
Phalcon\Mvc\Dispatcher\Exception: MobileProject\Frontend\Controllers\IndexController handler class cannot be loaded in /var/www/phalcon/library/Phalcon/Error/Handler.php on line 123
Why is he trying to load the defaultHandler?
Is there any example for a multi module application with error handling?
Thank you, Toby :)