aws_sdk_ssooidc/protocol_serde/
shape_invalid_request_exception.rs1pub(crate) fn de_invalid_request_exception_json_err(
3 value: &[u8],
4 mut builder: crate::types::error::builders::InvalidRequestExceptionBuilder,
5) -> ::std::result::Result<crate::types::error::builders::InvalidRequestExceptionBuilder, ::aws_smithy_json::deserialize::error::DeserializeError> {
6 let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
7 let tokens = &mut tokens_owned;
8 ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
9 loop {
10 match tokens.next().transpose()? {
11 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
12 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
13 "error" => {
14 builder = builder.set_error(
15 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
16 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
17 .transpose()?,
18 );
19 }
20 "reason" => {
21 builder = builder.set_reason(
22 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
23 .map(|s| s.to_unescaped().map(|u| crate::types::InvalidRequestExceptionReason::from(u.as_ref())))
24 .transpose()?,
25 );
26 }
27 "error_description" => {
28 builder = builder.set_error_description(
29 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
30 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
31 .transpose()?,
32 );
33 }
34 "Message" => {
35 builder = builder.set_message(
36 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
37 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
38 .transpose()?,
39 );
40 }
41 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
42 },
43 other => {
44 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
45 "expected object key or end object, found: {other:?}"
46 )))
47 }
48 }
49 }
50 if tokens.next().is_some() {
51 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
52 "found more JSON tokens after completing parsing",
53 ));
54 }
55 Ok(builder)
56}