aboutsummaryrefslogtreecommitdiff
path: root/gn_auth/errors/http/http_4xx_errors.py
blob: 3a2ed8840cec73f4df810fee5c49056d0948ce63 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""Handlers for HTTP 4** errors"""
import logging

from werkzeug.exceptions import NotFound, Forbidden, Unauthorized

from gn_auth.errors.common import build_handler

__all__ = ["http_4xx_error_handlers"]

logger = logging.getLogger(__name__)


def http_4xx_error_handlers() -> dict:
    """Return handlers for HTTP errors in the 400-499 range"""
    return {
        Forbidden: build_handler(
            "You do not have the necessary privileges to access the requested "
            "resource."),
        NotFound: build_handler(
            "The requested page does not exist on this server."),
        Unauthorized: build_handler(
            "You are not authorised to access the requested resource.")
    }