Catch panics in handlers and wrap them into exceptions.