mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-01-06 03:57:57 -05:00
Convert http.HTTPStatus objects to their int equivalent (#7188)
This commit is contained in:
parent
0f05fd1530
commit
07b88c546d
1
changelog.d/7188.misc
Normal file
1
changelog.d/7188.misc
Normal file
@ -0,0 +1 @@
|
||||
Fix consistency of HTTP status codes reported in log lines.
|
@ -86,7 +86,14 @@ class CodeMessageException(RuntimeError):
|
||||
|
||||
def __init__(self, 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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user