code: async def handle_exception(self, error: Exception) -> Response:
          
          await got_request_exception.send(self, exception=error)
  
          self.log_exception(sys.exc_info())
  
          if self.propagate_exceptions:
              return await traceback_response()
  
          internal_server_error = all_http_exceptions[500]()
          handler = self._find_exception_handler(internal_server_error)
  
          if handler is None:
              return internal_server_error.get_response()
          else:
              return await self.finalize_request(await handler(error), from_error_handler=True)
docs: Handle an uncaught exception.
  
          By default this switches the error response to a 500 internal
          server error.