Skip to content

Commit 93bfa17

Browse files
committed
šŸ› Refactor user error message handling in HTTP error middleware to prioritize exception text
1 parent 72eba19 commit 93bfa17

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

ā€Žpackages/service-library/src/servicelib/aiohttp/rest_middlewares.pyā€Ž

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ def _handle_http_error(
117117

118118
if not exception.text or not is_enveloped_from_text(exception.text):
119119
# NOTE: aiohttp.HTTPException creates `text = f"{self.status}: {self.reason}"`
120-
# We do not like for the user to pop up a message like "401: You are not authorized"
121-
user_error_msg = exception.reason or exception.text or "Unexpected error"
120+
user_error_msg = exception.text or "Unexpected error"
122121
error_model = ErrorGet(
123122
errors=[
124123
ErrorItemType.from_error(exception),

0 commit comments

Comments
Ā (0)