Skip to content

Commit 7683f75

Browse files
authored
May 18th Release v0.0.4-alpha, smithy-rs v0.9 (#83)
1 parent 140fe74 commit 7683f75

File tree

130 files changed

+88391
-34240
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+88391
-34240
lines changed

sdk/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[workspace]
22
members = [
3-
"dynamodb","kinesis","apigateway","qldb","polly","kms","qldbsession","secretsmanager","smithy-types","smithy-http","smithy-http-tower","protocol-test-helpers","aws-auth","aws-endpoint","aws-types","aws-hyper","aws-sig-auth","aws-http","examples/dynamo-delete-item","examples/dynamo-list-items","examples/kinesis-list-streams","examples/secretsmanager-create-secret","examples/secretsmanager-get-secret-value","examples/polly-describe-voices","examples/secretsmanager-helloworld","examples/polly-synthesize-speech","examples/dynamo-create-table","examples/polly-put-lexicon","examples/dynamo-list-tables","examples/qldbsession-helloworld","examples/dynamo-helloworld","examples/kinesis-create-stream","examples/polly-helloworld","examples/secretsmanager-list-secrets","examples/polly-list-lexicons","examples/kms-helloworld","examples/kinesis-describe-stream","examples/dynamo-delete-table","examples/qldb-list-ledgers","examples/dynamo-add-item","examples/kinesis-delete-stream","examples/dynamo-movies","examples/kinesis-put-record"
3+
"dynamodb","kinesis","lambda","apigateway","qldb","polly","kms","qldbsession","secretsmanager","smithy-types","smithy-http","smithy-http-tower","protocol-test-helpers","aws-auth","aws-endpoint","aws-types","aws-hyper","aws-sig-auth","aws-http","examples/dynamo-delete-item","examples/lambda-list-functions","examples/dynamo-list-items","examples/kinesis-list-streams","examples/secretsmanager-create-secret","examples/secretsmanager-get-secret-value","examples/polly-describe-voices","examples/secretsmanager-helloworld","examples/polly-synthesize-speech","examples/dynamo-create-table","examples/polly-put-lexicon","examples/dynamo-list-tables","examples/qldbsession-helloworld","examples/dynamo-helloworld","examples/kinesis-create-stream","examples/polly-helloworld","examples/secretsmanager-list-secrets","examples/polly-list-lexicons","examples/lambda-invoke-function","examples/kms-helloworld","examples/kinesis-describe-stream","examples/dynamo-delete-table","examples/qldb-list-ledgers","examples/dynamo-add-item","examples/kinesis-delete-stream","examples/dynamo-movies","examples/kinesis-put-record"
44
]

sdk/apigateway/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ version = "0.2"
2929
path = "..//aws-http"
3030
[dependencies.aws-sig-auth]
3131
path = "..//aws-sig-auth"
32+
[dependencies.bytes]
33+
version = "1"
3234
[dependencies.serde_json]
3335
version = "1"
3436
features = ["float_roundtrip"]
35-
[dependencies.bytes]
36-
version = "1"
3737
[features]
3838
client = ["aws-hyper"]
3939
rustls = ["aws-hyper/rustls"]

sdk/apigateway/src/aws_json_errors.rs

+26
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
use http::header::ToStrError;
88

9+
// currently only used by AwsJson
10+
#[allow(unused)]
911
pub fn is_error<B>(response: &http::Response<B>) -> bool {
1012
!response.status().is_success()
1113
}
@@ -50,6 +52,8 @@ pub fn parse_generic_error<B>(
5052
.map(|s| sanitize_error_code(s).to_string());
5153
let message = body
5254
.get("message")
55+
.or_else(|| body.get("Message"))
56+
.or_else(|| body.get("errorMessage"))
5357
.and_then(|v| v.as_str())
5458
.map(|s| s.to_string());
5559
let request_id = response
@@ -135,4 +139,26 @@ mod test {
135139
"FooError"
136140
);
137141
}
142+
143+
// services like lambda use an alternate `Message` instead of `message`
144+
#[test]
145+
fn alternative_error_message_names() {
146+
let response = http::Response::builder()
147+
.header("x-amzn-errortype", "ResourceNotFoundException")
148+
.body(json!({
149+
"Type": "User",
150+
"Message": "Functions from 'us-west-2' are not reachable from us-east-1"
151+
}))
152+
.unwrap();
153+
assert_eq!(
154+
parse_generic_error(&response, response.body()),
155+
Error {
156+
code: Some("ResourceNotFoundException".to_string()),
157+
message: Some(
158+
"Functions from 'us-west-2' are not reachable from us-east-1".to_string()
159+
),
160+
request_id: None,
161+
}
162+
)
163+
}
138164
}

0 commit comments

Comments
 (0)