Skip to content

Commit a51bd66

Browse files
authored
Merge pull request #8 from tlinhart/hashable-httpqueryerror
Make HttpQueryError hashable
2 parents 042ef2e + fc18938 commit a51bd66

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

graphql_server/error.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import json
2+
3+
14
class HttpQueryError(Exception):
25
def __init__(self, status_code, message=None, is_graphql_error=False, headers=None):
36
self.status_code = status_code
@@ -11,3 +14,6 @@ def __eq__(self, other):
1114
other.status_code == self.status_code and \
1215
other.message == self.message and \
1316
other.headers == self.headers
17+
18+
def __hash__(self):
19+
return hash((self.status_code, self.message, json.dumps(self.headers)))

0 commit comments

Comments
 (0)