public static function handle_booking_unauthorized_exception(Exception $e) { if ($e instanceof booking_unauthorized_exception) { $message = htmlentities('HTTP/1.0 401 Unauthorized to ' . $e->get_operation(), null, self::encoding()); $exception_message = $e->getMessage(); if (!empty($exception_message)) { $message .= ' - ' . htmlentities($exception_message, null, self::encoding()); } header($message); echo "<html><head><title>{$message}</title></head><body><strong>{$message}</strong></body></html>"; } else { if (self::$old_exception_handler) { call_user_func(self::$old_exception_handler, $e); } } }