Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
07b88c54
Unverified
Commit
07b88c54
authored
4 years ago
by
Andrew Morgan
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Convert http.HTTPStatus objects to their int equivalent (#7188)
parent
0f05fd15
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/7188.misc
+1
-0
1 addition, 0 deletions
changelog.d/7188.misc
synapse/api/errors.py
+8
-1
8 additions, 1 deletion
synapse/api/errors.py
with
9 additions
and
1 deletion
changelog.d/7188.misc
0 → 100644
+
1
−
0
View file @
07b88c54
Fix consistency of HTTP status codes reported in log lines.
This diff is collapsed.
Click to expand it.
synapse/api/errors.py
+
8
−
1
View file @
07b88c54
...
@@ -86,7 +86,14 @@ class CodeMessageException(RuntimeError):
...
@@ -86,7 +86,14 @@ class CodeMessageException(RuntimeError):
def
__init__
(
self
,
code
,
msg
):
def
__init__
(
self
,
code
,
msg
):
super
(
CodeMessageException
,
self
).
__init__
(
"
%d: %s
"
%
(
code
,
msg
))
super
(
CodeMessageException
,
self
).
__init__
(
"
%d: %s
"
%
(
code
,
msg
))
self
.
code
=
code
# Some calls to this method pass instances of http.HTTPStatus for `code`.
# While HTTPStatus is a subclass of int, it has magic __str__ methods
# which emit `HTTPStatus.FORBIDDEN` when converted to a str, instead of `403`.
# This causes inconsistency in our log lines.
#
# To eliminate this behaviour, we convert them to their integer equivalents here.
self
.
code
=
int
(
code
)
self
.
msg
=
msg
self
.
msg
=
msg
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment