Feature Request #4132

Allow exception handlers to be centrally registered

Added by Luke Morton 10 months ago. Updated 5 months ago.

Status:New Start date:07/25/2011
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:Core
Target version:Unscheduled
Resolution: Points:

Description

Currently the way Kohana handles exceptions is not as flexible as it could be when it comes to allowing developers to customise the this behaviour. For example some modules such as Kostache, and also core files such as Kohana_View reference `Kohana_Exception::handler()` directly (specifically for ::__toString() issues). This then enforces the need for developers to overwrite or extend Kohana_Exception directly.

I imagine a more flexible solution would be to allow developers to register exception handlers in their bootstrap as we currently do for `Log_Writer`s and `Config_Reader`s.

// Attach a handler
Kohana::$exception_handler->attach(new Custom_Exception_Handler);
// Handle an exception using attached handler
Kohana::$exception_handler->handle(new Kohana_Exception('Testing');

This could allow multiple handlers for exceptions although this isn't a necessity for my own usage.

History

Updated by Jeremy Bush 5 months ago

  • Target version changed from v3.3.0 to Unscheduled

Also available in: Atom PDF