diff --git a/src/firebase_functions/https_fn.py b/src/firebase_functions/https_fn.py index 7233e7f..30c8596 100644 --- a/src/firebase_functions/https_fn.py +++ b/src/firebase_functions/https_fn.py @@ -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: diff --git a/tests/test_https_fn.py b/tests/test_https_fn.py index 7a937e2..8123669 100644 --- a/tests/test_https_fn.py +++ b/tests/test_https_fn.py @@ -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",))