Panic notifications

add functions for notifying on panics (to be used by a user inside a `defer` call).

Panics can (apparently) happen on any interface, so we need to convert those into `error` here.