Repository navigation
Description
Summary
Several services return the bare HTTP status ("404") or a near-miss spelling in
Error.Code, where AWS returns a documented symbolic code. botocore surfaces
Error.Code verbatim as ClientError.response["Error"]["Code"], and that string is
what every except ClientError branch in real client code compares against — so a
numeric code silently defeats the caller's error handling.
Reproduction
Against ghcr.io/scttfrdmn/substrate:0.76.0, e.response["Error"]["Code"]:
| Call | substrate | AWS |
|---|---|---|
ssm.get_parameter(Name="/nope") |
"404" |
ParameterNotFound |
lambda.get_function(FunctionName="nope") |
"404" |
ResourceNotFoundException |
iam.get_role(RoleName="nope") |
"NoSuchEntityException" |
NoSuchEntity |
s3.get_object(Bucket=<missing bucket>, Key="k") |
"NoSuchKey" |
NoSuchBucket |
The IAM one is subtle: NoSuchEntityException is the shape name in the API
model, while the wire error code is NoSuchEntity. (lambda genuinely does use
the ...Exception suffix on the wire, so the two services differ.)
The S3 case conflates two distinct conditions — a missing bucket and a missing key
in an existing bucket both return NoSuchKey, so a caller cannot tell "someone
deleted my bucket" from "this object isn't written yet".
Expected
Error.Code carries the documented symbolic code for each service. HTTP status
stays in ResponseMetadata.HTTPStatusCode, where callers that want it can find it.
Why it matters
From parsl-ephemeral-aws, the read-then-create idiom that Parameter Store state
persistence is built on:
try:
self.ssm_client.put_parameter(Name=name, Value=v, Overwrite=True)
except ClientError as e:
if e.response["Error"]["Code"] == "ParameterNotFound":
self.ssm_client.put_parameter(Name=name, Value=v, Tags=[...]) # create with tags
else:
raiseWith Code == "404" the branch is skipped and the exception propagates, so the
create-with-tags path cannot be tested at all. Same structure appears for
NoSuchEntity (IAM role/instance-profile creation, 7 call sites) and NoSuchKey
(S3 state store, 3 call sites).
These are the codes that distinguish "not there yet, create it" from "real
failure" — the branch an emulator is most useful for exercising.
Activity
test(iam,s3): assert every renamed error code and the store-failure p…
fix(errors): serialize errors in each service's wire protocol (#392) (#…
fix(lambda): omit FunctionError and LogResult unless applicable (#393) (
chore(release): v0.80.0 (#423)
test(sqs): a store failure must not read as QueueDoesNotExist (#413)
feat(sqs): seedable create-then-lookup consistency window (#413) (#427)
feat(protocol): shape errors by the request's protocol (#757, #758) (#…