api/utils/exceptions.py
def determine_code_from_error(e):
    """From error / exception, determine appropriate http code"""
    if isinstance(e, NotFoundError):
        return 404
    if isinstance(e, ValueError):
        # HTTP Bad Request
        return 400
    if isinstance(e, Forbidden):
        return 403
    if isinstance(e, NotImplementedError):
        return 501

    return 500
From error / exception, determine appropriate http code
From error / exception, determine appropriate http code
From error / exception determine appropriate http code
def determine_code_from_error(e):
    if isinstance(e, NotFoundError):
        return 404
    if isinstance(e, ValueError):
        return 400
    if isinstance(e, Forbidden):
        return 403
    if isinstance(e, NotImplementedError):
        return 501
    return 500
def determine_code_from_error ( e ) : if isinstance ( e , NotFoundError ) : return 404 if isinstance ( e , ValueError ) : return 400 if isinstance ( e , Forbidden ) : return 403 if isinstance ( e , NotImplementedError ) : return 501 return 500
From error / exception, determine appropriate http code
From error / exception determine appropriate http code
"""From error / exception, determine appropriate http code""" # HTTP Bad Request
e