tgstation / rust-g

Rust based libraries for tgstation
MIT License
28 stars 100 forks source link

Global panic hook + catch_unwind #120

Closed Mothblocks closed 6 months ago

Mothblocks commented 2 years ago

Fixes #118.

Will log to rustg_panic.log, though I'm not sure where that's going to end up being.

Mothblocks commented 2 years ago

Drafted so I can make output path configurable

AffectedArc07 commented 1 year ago

Dumb question, this is entirely "safe" and "rust native"?

IE - its not auxtools levels of process hooking or similar, its just normal stuff?

Mothblocks commented 1 year ago

I forgot to finish this oops

Yes this is completely fine, ctor is a tiny hack but extremely battle tested and absolutely nowhere close to anything like auxtools

Mothblocks commented 1 year ago

I'm not sure if this should be failing "silently" like it is now since that is going to cause problems, but that is how it is implemented right now 😓

Going to update this so that we can get a better grasp of errors on tg

itsmeow commented 10 months ago

@Mothblocks My suggestion is just make it up to the individual modules how to handle a panic unwind. My module currently returns the panic string directly, since it normally outputs JSON that is quite easy to test for.

Obviously for something like file_read it's a bit more difficult, but for now I think it's better than crashing the entire game.

ZeWaka commented 6 months ago

Mostly implemented in #160, this is pretty abandoned these days.