Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/firebase_functions/https_fn.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def __init__(

self._http_error_code = _error_code_map[code]

super().__init__()
super().__init__(message)

def _as_dict(self) -> _HttpErrorWireFormat:
if self.details is None:
Expand Down
13 changes: 13 additions & 0 deletions tests/test_https_fn.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,16 @@ def init():
decorated_func(request)

self.assertEqual("world", hello)

def test_https_error_passes_message_to_super(self):
"""
HttpsError should pass the message to the base Exception so that
str(err) and err.args contain the message.
"""
err = https_fn.HttpsError(
code=https_fn.FunctionsErrorCode.INVALID_ARGUMENT,
message="something went wrong",
)

self.assertEqual(str(err), "something went wrong")
self.assertEqual(err.args, ("something went wrong",))
Loading