Skip to content

Commit ef91b8d

Browse files
ChristineWanjaucwanjau
andauthored
fix(appconfiguration): handle 403 Forbidden to avoid JSONDecodeError (#46446)
* fix: raise HttpResponseError on 403 to prevent JSONDecodeError on empty body * pass exception * Update changelog --------- Co-authored-by: cwanjau <cwanjau@microsoft.com>
1 parent 2ab67bc commit ef91b8d

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

  • sdk/appconfiguration/azure-appconfiguration

sdk/appconfiguration/azure-appconfiguration/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
### Bugs Fixed
1010

11+
- Fixed an issue where authorization failures caused crashes. Now an `HttpResponseError` is returned when the required data plane role is missing.
12+
1113
### Other Changes
1214

1315
## 1.8.0 (2026-01-26)

sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_operations/_patch.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def get_key_values_in_one_page(
104104

105105
error_map: MutableMapping[int, Type[HttpResponseError]] = {
106106
401: ClientAuthenticationError,
107+
403: HttpResponseError,
107108
404: ResourceNotFoundError,
108109
409: ResourceExistsError,
109110
304: ResourceNotModifiedError,
@@ -195,7 +196,11 @@ def prepare_request(next_link=None):
195196

196197
if response.status_code not in valid_status_codes:
197198
map_error(status_code=response.status_code, response=response, error_map=error_map)
198-
error = _deserialize(_models.Error, response.json())
199+
error = None
200+
try:
201+
error = _deserialize(_models.Error, response.json())
202+
except (ValueError, KeyError):
203+
pass
199204
raise HttpResponseError(response=response, model=error)
200205

201206
response_headers = response.headers

0 commit comments

Comments
 (0)