forked from ThePalaceProject/library-registry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
problem_details.py
81 lines (67 loc) · 2.24 KB
/
problem_details.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
from flask_babel import lazy_gettext as lgt
from util.problem_detail import ProblemDetail as pd
AUTHENTICATION_FAILURE = pd(
"http://librarysimplified.org/terms/problem/credentials-invalid",
401,
lgt("The library could not be authenticated."),
)
NO_AUTH_URL = pd(
"http://librarysimplified.org/terms/problem/no-opds-auth-url",
400,
lgt("No Authentication For OPDS URL"),
lgt(
"You must provide the URL to an Authentication For OPDS document to register a library."
),
)
INVALID_INTEGRATION_DOCUMENT = pd(
"http://librarysimplified.org/terms/problem/invalid-integration-document",
400,
lgt("Invalid Integration document"),
)
TIMEOUT = pd(
"http://librarysimplified.org/terms/problem/timeout",
408,
lgt("Request timed out"),
lgt("Attempt to retrieve an Authentication For OPDS document timed out."),
)
INTEGRATION_DOCUMENT_NOT_FOUND = pd(
"http://librarysimplified.org/terms/problem/integration-document-not-found",
400,
title=lgt("Document not found"),
)
INTEGRATION_ERROR = pd(
"http://librarysimplified.org/terms/problem/remote-integration-failed",
500,
title=lgt("Error with external integration"),
)
ERROR_RETRIEVING_DOCUMENT = pd(
"http://librarysimplified.org/terms/problem/remote-integration-failed",
502,
title=lgt("Could not retrieve document"),
detail=lgt("I couldn't retrieve the specified URL."),
)
INVALID_CONTACT_URI = pd(
"http://librarysimplified.org/terms/problem/invalid-contact-uri",
400,
title=lgt("URI was not specified or is of the wrong type"),
)
LIBRARY_ALREADY_IN_PRODUCTION = pd(
"http://librarysimplified.org/terms/problem/invalid-stage",
400,
title=lgt("Library cannot be taken out of production once in production."),
)
LIBRARY_NOT_FOUND = pd(
"http://librarysimplified.org/terms/problem/library-not-found",
404,
title=lgt("The library does not exist in this registry."),
)
INVALID_CREDENTIALS = pd(
"http://librarysimplified.org/terms/problem/invalid-credentials",
401,
title=lgt("The username or password is incorrect."),
)
UNABLE_TO_NOTIFY = pd(
"http://librarysimplified.org/terms/problem/unable-to-notify",
500,
title=lgt("Registry server unable to send notification emails."),
)