|
8 | 8 | from common_library.error_codes import ErrorCodeStr |
9 | 9 | from common_library.json_serialization import json_dumps |
10 | 10 | from models_library.rest_error import ErrorGet, ErrorItemType |
| 11 | +from servicelib.rest_constants import RESPONSE_MODEL_POLICY |
11 | 12 |
|
12 | 13 | from ..aiohttp.status import HTTP_200_OK |
13 | 14 | from ..mimetype_constants import MIMETYPE_APPLICATION_JSON |
14 | | -from ..rest_constants import RESPONSE_MODEL_POLICY |
15 | 15 | from ..rest_responses import is_enveloped |
16 | 16 | from ..status_codes_utils import get_code_description |
17 | 17 |
|
@@ -54,7 +54,7 @@ def create_http_error( |
54 | 54 | http_error_cls: type[HTTPError] = web.HTTPInternalServerError, |
55 | 55 | *, |
56 | 56 | skip_internal_error_details: bool = False, |
57 | | - error_code: ErrorCodeStr | None = None, |
| 57 | + error_code: ErrorCodeStr | None = None |
58 | 58 | ) -> HTTPError: |
59 | 59 | """ |
60 | 60 | - Response body conforms OAS schema model |
@@ -90,8 +90,9 @@ def create_http_error( |
90 | 90 | payload = wrap_as_envelope( |
91 | 91 | error=error.model_dump(mode="json", **RESPONSE_MODEL_POLICY) |
92 | 92 | ) |
| 93 | + |
93 | 94 | return http_error_cls( |
94 | | - # NOTE: reason cannot contain new lines |
| 95 | + # Multiline not allowed in HTTP reason |
95 | 96 | reason=reason.replace("\n", " ") if reason else None, |
96 | 97 | text=json_dumps( |
97 | 98 | payload, |
|
0 commit comments