TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
These forums are read-only and for archival purposes only!
Please join our new forums at discourse.kohanaframework.org
Oh the Irony
  • It looks like the official documentation for Kohana error handling is well.. throwing an error.

  • Yeah it's been like that for an unfunny amount of time as well. Near 11 months since 3.1 was released see: http://dev.kohanaframework.org/issues/4225

  • // Should trigger an ErrorException with an E_NOTICE level
    

    change this line into error_reporting(E_ALL & ~E_NOTICE);

  • The real problem is here, for some unknown reason that try / catch block is failing to catch the ErrorException.

    I've only looked into this briefly the other day due to some unrelated 3.3 changes, and haven't had a chance to investigate further yet.

  • I had a look into it.

    @kiall: that try/catch block is working fine. It's just that Kohana_exception::handler($e); calls exit(1) ;)

  • Assuming the exception is being caught the problem is handing off to Kohana_Exception::handler() ends in one way, a call to exit().

  • Aha .. That should be fixable :)

  • The solution is really simple. We should use an image of the stack trace instead of trying to show the real thing. In earlier versions of Kohana we didn't call exit in the exception handler so it was possible to continue after creating an exception. This isn't possible anymore (and shouldn't be).

  • The point was to be able to interact with the exception handler within that context, but that probably isn't necessary.

  • It actually will be possible with some of my 3.3 changes:

    try
    { 
        throw new Exception('Test');
    }
    catch (Exception $e)
    {
        // the Kohana_Exception::response() method returns an instance
        // of Response with the exception view/details/code etc
        $output = Kohana_Exception::response($e)->body();
    }
    

    But an image is probably the better fix! Who's smartarse idea was doing it this way to begin with? ;)

  • Gotta love git blame :P

    I'll just leave this here...

  • Yup, that's right... I committed that code. You could have just asked... no need to use the b-word. ;)

  • Well it actually worked when that commit was created. Adding exit(1) is what broke it ;)

  • Ehm. Maybe I'm completely wrong here. But why not use an iframe to show the error? That way you can play with the stack trace and still not break the interface.

  • @rjd22 That's a clever idea... a proper use for an iframe!

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion