refactor(utils): simplify HTTP error payload key lookup
Some checks failed
Tests / Declarative: Post Actions tests.test_utils.test_safe_error_detail_http_status_json failed
Some checks failed
Tests / Declarative: Post Actions tests.test_utils.test_safe_error_detail_http_status_json failed
Collapse the payload message lookup to the two conventional keys.
This commit is contained in:
parent
011bc2c993
commit
a76a4a96af
@ -12,7 +12,7 @@ def _runtime_error_detail(exc: Exception) -> str | None:
|
|||||||
|
|
||||||
def _http_message_from_payload(payload: object) -> str | None:
|
def _http_message_from_payload(payload: object) -> str | None:
|
||||||
if isinstance(payload, dict):
|
if isinstance(payload, dict):
|
||||||
raw = payload.get("errorMessage") or payload.get("error") or payload.get("message")
|
raw = payload.get("error") or payload.get("message")
|
||||||
if isinstance(raw, str) and raw.strip():
|
if isinstance(raw, str) and raw.strip():
|
||||||
return raw.strip()
|
return raw.strip()
|
||||||
if isinstance(payload, str) and payload.strip():
|
if isinstance(payload, str) and payload.strip():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user