src/dirbs/api/common/handlers.py
def validate_error(error) -> BadRequest:
    """
    Transform marshmallow validation errors to custom responses to maintain backward-compatibility.

    Arguments:
        error: intercepted http error object
    Returns:
        custom http error message
    """
    field_name = error.exc.field_names[0]
    field_value = error.exc.data[field_name] if error.exc.data else None
    field_type = error.exc.fields[0]
    if isinstance(field_type, fields.List) and field_value and isinstance(error.exc.messages, list):
        field_type = error.exc.fields[0].container
        field_value = error.exc.data[field_name][next(iter(error.exc.messages[field_name]))]
    else:
        field_value = error.exc.messages[field_name]
    return BadRequest(description=get_error_desc(field_type, field_name, field_value))

    Transform marshmallow validation errors to custom responses to maintain backward-compatibility.

    Arguments:
        error: intercepted http error object
    Returns:
        custom http error message
    
Transform marshmallow validation errors to custom responses to maintain backward-compatibility.
Transform marshmallow validation errors to custom responses to maintain backward - compatibility .
def validate_error(error) -> BadRequest:
    field_name = error.exc.field_names[0]
    field_value = error.exc.data[field_name] if error.exc.data else None
    field_type = error.exc.fields[0]
    if isinstance(field_type, fields.List) and field_value and isinstance(error.exc.messages, list):
        field_type = error.exc.fields[0].container
        field_value = error.exc.data[field_name][next(iter(error.exc.messages[field_name]))]
    else:
        field_value = error.exc.messages[field_name]
    return BadRequest(description=get_error_desc(field_type, field_name, field_value))
def validate_error ( error ) -> BadRequest : field_name = error . exc . field_names [ 0 ] field_value = error . exc . data [ field_name ] if error . exc . data else None field_type = error . exc . fields [ 0 ] if isinstance ( field_type , fields . List ) and field_value and isinstance ( error . exc . messages , list ) : field_type = error . exc . fields [ 0 ] . container field_value = error . exc . data [ field_name ] [ next ( iter ( error . exc . messages [ field_name ] ) ) ] else : field_value = error . exc . messages [ field_name ] return BadRequest ( description = get_error_desc ( field_type , field_name , field_value ) )
Transform marshmallow validation errors to custom responses to maintain backward-compatibility.
Transform marshmallow validation errors to custom responses to maintain backward - compatibility .
"""
    Transform marshmallow validation errors to custom responses to maintain backward-compatibility.

    Arguments:
        error: intercepted http error object
    Returns:
        custom http error message
    """
custom http error message
custom http error message
error
intercepted http error object
intercepted http error object