FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
graphql-server/graphql_server/error.py at python3.7-eol · graphql-python/graphql-server · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
graphql-python
/
graphql-server
Public
Notifications
You must be signed in to change notification settings
Fork
70
Star
134
Code
Issues
5
Pull requests
2
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
graphql-server
/
graphql_server
/
error.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
33 lines (26 loc) · 1.22 KB
Breadcrumbs
graphql-server
/
graphql_server
/
error.py
Copy path
File metadata and controls
33 lines (26 loc) · 1.22 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
"""Error classes provided by graphql_server"""
__all__
=
[
"HttpQueryError"
]
class
HttpQueryError
(
Exception
):
"""The error class for HTTP errors produced by running GraphQL queries."""
def
__init__
(
self
,
status_code
,
message
=
None
,
is_graphql_error
=
False
,
headers
=
None
):
"""Create a HTTP query error.
You need to pass the HTTP status code, the message that shall be shown,
whether this is a GraphQL error, and the HTTP headers that shall be sent.
"""
self
.
status_code
=
status_code
self
.
message
=
message
self
.
is_graphql_error
=
is_graphql_error
self
.
headers
=
headers
super
(
HttpQueryError
,
self
).
__init__
(
message
)
def
__eq__
(
self
,
other
):
"""Check whether this HTTP query error is equal to another one."""
return
(
isinstance
(
other
,
HttpQueryError
)
and
other
.
status_code
==
self
.
status_code
and
other
.
message
==
self
.
message
and
other
.
headers
==
self
.
headers
)
def
__hash__
(
self
):
"""Create a hash value for this HTTP query error."""
headers_hash
=
tuple
(
self
.
headers
.
items
())
if
self
.
headers
else
None
return
hash
((
self
.
status_code
,
self
.
message
,
headers_hash
))
Back
|
FazBrowse Home
|
New Git URL