File tree Expand file tree Collapse file tree
sdk/storage/azure-storage-queue/azure/storage/queue/_shared Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,8 +96,14 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # p
9696 )
9797 if not storage_error .response or storage_error .response .status_code in [200 , 204 ]:
9898 raise storage_error
99- # If it is one of those three then it has been serialized prior by the generated layer.
100- if isinstance (
99+ # The generated layer now pre-maps 412 (Precondition Failed) responses to typed
100+ # exceptions based on the request's match condition (e.g. ResourceExistsError for
101+ # IfMissing, ResourceNotFoundError for IfPresent). Historically 412 was not
102+ # pre-mapped and always flowed through the error-code mapping below, surfacing as
103+ # ResourceModifiedError. Skip the "already serialized" shortcut for 412 so it is
104+ # re-mapped from x-ms-error-code (ConditionNotMet -> ResourceModifiedError) and the
105+ # public exception type is preserved for users.
106+ if storage_error .response .status_code != 412 and isinstance (
101107 storage_error ,
102108 (
103109 PartialBatchErrorException ,
You can’t perform that action at this time.
0 commit comments