ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

UhOh! - Better Errors for CodeIgniter

July 15, 2010 2:55pm

Subscribe [18]
  • #1 / Jul 15, 2010 2:55pm

    Dan Horrigan

    342 posts

    UhOh is an extension on CI_Extensions that provides awesome error messages with full back traces and a view of the line with the error.

    It catches all errors including:

    E_PARSE
    E_ERROR
    E_USER_ERROR
    E_COMPILE_ERROR
    E_ERROR
    E_USER_ERROR
    E_PARSE
    E_WARNING
    E_USER_WARNING
    E_STRICT
    E_NOTICE
    E_RECOVERABLE_ERROR

    It also outputs full back traces for all CodeIgniter system errors. No more “Where is it trying to load that view?”, it will show you the line that called it and the surrounding lines.

    UhOh! is based on Kohana v3’s error handling. The file contains some code from the Kohana project.
    Kohana License

    Some screen shots:
    PHP Parser Error: http://cl.ly/1eR7
    CodeIgniter Errors (i.e. loading a missing view): http://cl.ly/1epj
    Errors from your app using show_error(): http://cl.ly/1euq

    Download
    Version 1.3: Download on GitHub

    Let me know what you think or if you have issues.  Install instructions are in the README.

  • #2 / Jul 15, 2010 3:31pm

    danmontgomery

    1802 posts

    Had to fix line 87 of MY_Exceptions.php:

    $file = 'APPPATH/'.substr($file, strlen(ABS_APPPATH);
    $file = 'APPPATH/'.substr($file, strlen(ABS_APPPATH));

    I love it… but loading a missing view just gives me the show_error() error from the router (attached), and only after an exceedingly long load time. I’m using modular separation (tested in both 1.7.2 and 2.0) which I imagine is the cause.

  • #3 / Jul 15, 2010 3:34pm

    Dan Horrigan

    342 posts

    You must be running an old version.  Please re-download and re-install.  There is a new errors/error_general.php file as well.


    Thanks,
    Dan

  • #4 / Jul 15, 2010 3:38pm

    Dan Horrigan

    342 posts

    Sorry, I was wrong.  Just fixed the first issue and re-tagged.

    Missed the part that said you were running Modular Separation too…I am fixing that.

    Dan

  • #5 / Jul 15, 2010 4:05pm

    Dan Horrigan

    342 posts

    Just posted version 1.3 which fixes the issue with Modular Separation.  Please re-download the MY_Exceptions.php file and replace the existing one.

    Dan

  • #6 / Jul 16, 2010 6:12am

    MpaK69

    20 posts

    Thanx a lot! Greate hook!

    I said some few words about it at russian - http://mpak666.livejournal.com/540424.html

  • #7 / Jul 16, 2010 9:33am

    quasiperfect

    132 posts

    noctrum how u fixed the error on line 87 ?

    it seams i have the same error (i use ci2)

    Notice: Use of undefined constant ABS_APPPATH - assumed 'ABS_APPPATH' in C:\wamp\www\final\application\core\MY_Exceptions.php  on line 182
    
    Warning: require(ABS_APPPATHerrors/error_php_custom.php) [function.require]: failed to open stream: No such file or directory in C:\wamp\www\final\application\core\MY_Exceptions.php on line 182
    
    Fatal error: require() [function.require]: Failed opening required 'ABS_APPPATHerrors/error_php_custom.php' (include_path='.;C:\\php5\\pear') in C:\wamp\www\final\application\core\MY_Exceptions.php on line 182
  • #8 / Jul 16, 2010 10:00am

    danmontgomery

    1802 posts

    This isn’t the same error, the error I had was on line 87, yours is online 182. I just had to add an extra parenthesis to the end of the statement, which I posted. Dan fixed it almost immediately after that, so unless you downloaded it before I did you don’t have that problem.

    ABS_APPPATH is defined in the hook, so you probably haven’t enabled hooks.

  • #9 / Jul 16, 2010 12:53pm

    quasiperfect

    132 posts

    the hooks are enabled i will have to do some debuging

  • #10 / Jul 22, 2010 2:18pm

    anonymous41542

    436 posts

    Great lib! Already helped me out a lot during bugfixing.

  • #11 / Jul 25, 2010 4:21am

    tkyy

    67 posts

    i won’t use this for the same reason i don’t buy paper towels: because i don’t make mistakes. just kidding, nice library 😊

  • #12 / Jul 25, 2010 10:55pm

    Prophet

    38 posts

    Thanks Dan, I will be using this library to speed up debugging in some upcoming projects.

  • #13 / Jul 25, 2010 10:59pm

    sagarv

    5 posts

    edit (wrong thread)

  • #14 / Aug 04, 2010 6:26pm

    James McMurray

    23 posts

    the hooks are enabled i will have to do some debuging

    I’m getting the same error (running CI 1.5.4). I did not get the error running the exact same downloaded zip file of uhoh on a different server (running CI 1.7.2). The second server is mine and is a fresh install of CI with the only hook being uhoh. The one that fails is an inherited server which has Authlib also installed and enabled. There are also many other changes on that server which I couldn’t begin to enumerate since I don’t know them all. :|

    It looks like one of three things is happening:

    - uhoh doesn’t like CI 1.5.4
    - uhoh doesn’t like Authlib
    - some other change that was made to the inherited server is conflicting with uhoh

    Unfortunately adding uhoh to the server it died on was a side project, not a requirement, so I don’t know when I’ll be able to look deeper. If anyone else is experiencing this and can give some more info (or even a fix 😛 ), that’d be great.

  • #15 / Aug 04, 2010 6:26pm

    James McMurray

    23 posts

    I should probably add that I’ve been using uhoh on the server that works and it’s great. Thanks a lot for the hard work that went into making our lives easier! :D

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases