Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Custom Error Handler

Comments in 'General Discussion' started by PocketKiller, Aug 27, 2016.

?

Will it be a good idea for a custom error handler in PocketMine?

  1. Yes

    45.5%
  2. No

    27.3%
  3. No, It's useless

    27.3%
  1. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    Will it be a good idea to do a custom error handler in PocketMine? for example (What I use):
    PHP:
    set_error_handler("customError");

    function 
    customError($number$msg$file$line){
        if(
    $errno == 2048) return;
        echo 
    "\x1b[38;5;87m[" date("h:m:s") . "]\x1b[m \x1b[38;5;227m[Main/\x1b[38;5;124mERROR\x1b[m\x1b[38;5;227m]  => \x1b[38;5;124mError: [$number$msg in $file at line $linePHP_EOL;
    }
    echo 
    $test;
    results : [Hour:Minute:Second] [Main/ERROR] undefined variable: $test in (file) at line 9
    Note: These are escape codes for colors in MinTTY for Windows.

    And I didn't want to post this in github for some reason..
    and making the error goes in server.log.
    Last edited: Aug 27, 2016
    Legoboy0215 likes this.
  2. Ragnok1234
    Offline

    Ragnok1234 Active Member

    Joined:
    Jul 18, 2016
    Posts:
    53
    Minecraft User:
    Ragnok123
    No
  3. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    Why don't you vote instead?
  4. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    It might be a bad idea because it won't show the backtrace?
  5. Ragnok1234
    Offline

    Ragnok1234 Active Member

    Joined:
    Jul 18, 2016
    Posts:
    53
    Minecraft User:
    Ragnok123
    Yes
  6. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    What would be the difference ?
  7. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    The error goes in the server log.
    also a better interface? no I think.
  8. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    For that, you can simply set debug level above 1
  9. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    Ok then, vote.
  10. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    So, It's a no? ok.

Share This Page

Advertisement