Exemple #1
0
def internal_server_error(e):
    """
    Return a custom message for a 500 internal error
    :param e: Exception
    :return:
    """
    return response('failed', 'Internal server error', 500)
Exemple #2
0
def route_not_found(e):
    """
    Return a custom 404 Http response message for missing or not found routes.
    :param e: Exception
    :return: Http Response
    """
    return response('failed', 'Endpoint not found', 404)
Exemple #3
0
def services_down(e):
    """
    Custom response to 503 errors.
    :param e:
    :return:
    """
    return response('down', 'Services down', 503)
Exemple #4
0
def bad_method(e):
    """
    Custom response to 400 errors.
    :param e:
    :return:
    """
    return response('failed', 'Bad request', 400)
Exemple #5
0
def item_not_found(e):
    """
    Custom response to 404 errors.
    :param e:
    :return:
    """
    return response('failed', 'Item not found', 404)
Exemple #6
0
def method_not_found(e):
    """
    Custom response for methods not allowed for the requested URLs
    :param e: Exception
    :return:
    """
    return response('failed',
                    'The method is not allowed for the requested URL', 405)
Exemple #7
0
def health_information():
    """
    This is used for things to check the health of the app.
    """
    return response('up', 'Services up! Thanks for checking ', 200)