alliedmodders / amxmodx

AMX Mod X - Half-Life 1 Scripting and Administration
http://www.amxmodx.org/
489 stars 197 forks source link

[FEATURE REQUEST] Catch plugin errors #1032

Open bigdaddy424 opened 2 years ago

bigdaddy424 commented 2 years ago

Forward Example

  forward plugin_error(error_log[]) // or something similar

Use of forward

bigdaddy424 commented 2 years ago

plugin_log() will execute on server_print

Th3-822 commented 2 years ago

Maybe you should check set_error_filter()

bigdaddy424 commented 2 years ago

Can you provide an example? This doesn't seem to work

#include <amxmodx>
#include <fun>

public plugin_init(){
    register_srvcmd("func", "func")
    set_error_filter("error")
}

public func(){
    spawn(0)
}

public error(error_code, bool:debugging, message[]){
    server_print("ERROR[%d][%s]", error_code, message)
}
Th3-822 commented 2 years ago

This doesn't seem to work

Wait, What?

I don't know why it's working like that, but somebody should check it too