def response_internal_error()

in services/ui_backend_service/doc.py [0:0]


def response_internal_error(error_ids_and_descriptions={}):
    '''Formats a response object for internal errors.
    Includes all passed in keys in the 'id' enum field, along with 'generic-error'.
    Includes all values as descriptions for the error ids.
    '''
    # Include the default error-id.
    _errors = {
        "generic-error": "Non-Specific Error",
        "DataException": "Metaflow client DataException",
        "MetaflowS3AccessDenied": "S3 Access Denied",
        "MetaflowS3NotFound": "S3 error 404 not found",
        "MetaflowS3URLException": "S3 URL is malformed",
        "MetaflowS3Exception": "Something went wrong with S3 access",
        **error_ids_and_descriptions
    }
    error_ids = list(_errors.keys())
    description = "Specific error ID\n" + "\n".join([f"* {id} - {desc}" for id, desc in _errors.items()])
    return {
        "type": "object",
        "properties": {
            "id": {
                "type": "string",
                "enum": error_ids,
                "description": description
            },
            "traceback": {
                "type": "string",
                "description": "Stacktrace of the error"
            },
            "detail": {
                "type": "string",
                "description": "Detailed message of the error"
            },
            "status": {
                "type": "integer",
                "default": 500
            },
            "title": {
                "type": "string",
                "default": 'Internal Server Error'
            },
            "type": {
                "type": "string",
                "default": 'about:blank'
            },
        },
        "required": ["id", "traceback", "detail", "status", "title", "type"]
    }