Add error logging for panics