amxmodx icon indicating copy to clipboard operation
amxmodx copied to clipboard

[FEATURE REQUEST] Catch plugin errors

Open bigdaddy424 opened this issue 3 years ago • 4 comments

Forward Example

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

Use of forward

  • Push the error to an api, such as a discord webhook to get notified instantly

bigdaddy424 avatar Jan 13 '22 05:01 bigdaddy424

plugin_log() will execute on server_print

bigdaddy424 avatar Jan 13 '22 05:01 bigdaddy424

Maybe you should check set_error_filter()

Th3-822 avatar Jan 13 '22 14:01 Th3-822

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)
}

bigdaddy424 avatar Jan 15 '22 02:01 bigdaddy424

This doesn't seem to work

  • Compiles, (re)starts hlds (win), runs "func" * Doesn't work

  • Renames error filter callback to "asdfg", "asdfgh", "asdfghj" & "asdfghjk" and tries again * Doesn't work either

  • Renames error filter callback randomly to "ohmygah" and gives another try * Works

Wait, What?

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

Th3-822 avatar Jan 15 '22 06:01 Th3-822