MCPcopy
hub / github.com/benoitc/gunicorn / make_error_response

Function make_error_response

gunicorn/dirty/protocol.py:698–725  ·  view source on GitHub ↗

Build an error response message dict. Args: request_id: Request identifier this responds to error: DirtyError instance or dict with error info Returns: dict: Error response message dict

(request_id, error)

Source from the content-addressed store, hash-verified

696
697
698def make_error_response(request_id, error) -> dict:
699 """
700 Build an error response message dict.
701
702 Args:
703 request_id: Request identifier this responds to
704 error: DirtyError instance or dict with error info
705
706 Returns:
707 dict: Error response message dict
708 """
709 from .errors import DirtyError
710 if isinstance(error, DirtyError):
711 error_dict = error.to_dict()
712 elif isinstance(error, dict):
713 error_dict = error
714 else:
715 error_dict = {
716 "error_type": type(error).__name__,
717 "message": str(error),
718 "details": {},
719 }
720
721 return {
722 "type": DirtyProtocol.MSG_TYPE_ERROR,
723 "id": request_id,
724 "error": error_dict,
725 }
726
727
728def make_chunk_message(request_id, data) -> dict:

Callers 7

route_requestMethod · 0.70
_execute_on_workerMethod · 0.70
handle_manage_requestMethod · 0.70
handle_stash_requestMethod · 0.70
handle_requestMethod · 0.70

Calls 1

to_dictMethod · 0.45

Tested by

no test coverage detected