Struct aws_sdk_textract::error::AnalyzeExpenseError
source · #[non_exhaustive]pub struct AnalyzeExpenseError {
pub kind: AnalyzeExpenseErrorKind,
/* private fields */
}
Expand description
Error type for the AnalyzeExpense
operation.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.kind: AnalyzeExpenseErrorKind
Kind of error that occurred.
Implementations§
source§impl AnalyzeExpenseError
impl AnalyzeExpenseError
sourcepub fn new(kind: AnalyzeExpenseErrorKind, meta: Error) -> Self
pub fn new(kind: AnalyzeExpenseErrorKind, meta: Error) -> Self
Creates a new AnalyzeExpenseError
.
sourcepub fn unhandled(err: impl Into<Box<dyn Error + Send + Sync + 'static>>) -> Self
pub fn unhandled(err: impl Into<Box<dyn Error + Send + Sync + 'static>>) -> Self
Creates the AnalyzeExpenseError::Unhandled
variant from any error type.
Examples found in repository?
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379
pub fn parse_analyze_expense_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::AnalyzeExpenseOutput, crate::error::AnalyzeExpenseError> {
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::AnalyzeExpenseError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::AnalyzeExpenseError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"AccessDeniedException" => crate::error::AnalyzeExpenseError {
meta: generic,
kind: crate::error::AnalyzeExpenseErrorKind::AccessDeniedException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::access_denied_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_access_denied_exception_json_err(response.body().as_ref(), output).map_err(crate::error::AnalyzeExpenseError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"BadDocumentException" => crate::error::AnalyzeExpenseError {
meta: generic,
kind: crate::error::AnalyzeExpenseErrorKind::BadDocumentException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::bad_document_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_bad_document_exception_json_err(response.body().as_ref(), output).map_err(crate::error::AnalyzeExpenseError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"DocumentTooLargeException" => crate::error::AnalyzeExpenseError {
meta: generic,
kind: crate::error::AnalyzeExpenseErrorKind::DocumentTooLargeException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::document_too_large_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_document_too_large_exception_json_err(response.body().as_ref(), output).map_err(crate::error::AnalyzeExpenseError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InternalServerError" => crate::error::AnalyzeExpenseError {
meta: generic,
kind: crate::error::AnalyzeExpenseErrorKind::InternalServerError({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::internal_server_error::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_internal_server_error_json_err(response.body().as_ref(), output).map_err(crate::error::AnalyzeExpenseError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidParameterException" => crate::error::AnalyzeExpenseError {
meta: generic,
kind: crate::error::AnalyzeExpenseErrorKind::InvalidParameterException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_parameter_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_parameter_exception_json_err(response.body().as_ref(), output).map_err(crate::error::AnalyzeExpenseError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidS3ObjectException" => crate::error::AnalyzeExpenseError {
meta: generic,
kind: crate::error::AnalyzeExpenseErrorKind::InvalidS3ObjectException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_s3_object_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_s3_object_exception_json_err(response.body().as_ref(), output).map_err(crate::error::AnalyzeExpenseError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ProvisionedThroughputExceededException" => crate::error::AnalyzeExpenseError {
meta: generic,
kind: crate::error::AnalyzeExpenseErrorKind::ProvisionedThroughputExceededException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::provisioned_throughput_exceeded_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_provisioned_throughput_exceeded_exception_json_err(response.body().as_ref(), output).map_err(crate::error::AnalyzeExpenseError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ThrottlingException" => crate::error::AnalyzeExpenseError {
meta: generic,
kind: crate::error::AnalyzeExpenseErrorKind::ThrottlingException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::throttling_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_throttling_exception_json_err(response.body().as_ref(), output).map_err(crate::error::AnalyzeExpenseError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"UnsupportedDocumentException" => crate::error::AnalyzeExpenseError {
meta: generic,
kind: crate::error::AnalyzeExpenseErrorKind::UnsupportedDocumentException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::unsupported_document_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_unsupported_document_exception_json_err(response.body().as_ref(), output).map_err(crate::error::AnalyzeExpenseError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::AnalyzeExpenseError::generic(generic),
})
}
sourcepub fn generic(err: Error) -> Self
pub fn generic(err: Error) -> Self
Creates the AnalyzeExpenseError::Unhandled
variant from a aws_smithy_types::Error
.
Examples found in repository?
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379
pub fn parse_analyze_expense_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::AnalyzeExpenseOutput, crate::error::AnalyzeExpenseError> {
let generic = crate::json_deser::parse_http_generic_error(response)
.map_err(crate::error::AnalyzeExpenseError::unhandled)?;
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::error::AnalyzeExpenseError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"AccessDeniedException" => crate::error::AnalyzeExpenseError {
meta: generic,
kind: crate::error::AnalyzeExpenseErrorKind::AccessDeniedException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::access_denied_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_access_denied_exception_json_err(response.body().as_ref(), output).map_err(crate::error::AnalyzeExpenseError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"BadDocumentException" => crate::error::AnalyzeExpenseError {
meta: generic,
kind: crate::error::AnalyzeExpenseErrorKind::BadDocumentException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::bad_document_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_bad_document_exception_json_err(response.body().as_ref(), output).map_err(crate::error::AnalyzeExpenseError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"DocumentTooLargeException" => crate::error::AnalyzeExpenseError {
meta: generic,
kind: crate::error::AnalyzeExpenseErrorKind::DocumentTooLargeException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::document_too_large_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_document_too_large_exception_json_err(response.body().as_ref(), output).map_err(crate::error::AnalyzeExpenseError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InternalServerError" => crate::error::AnalyzeExpenseError {
meta: generic,
kind: crate::error::AnalyzeExpenseErrorKind::InternalServerError({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::internal_server_error::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_internal_server_error_json_err(response.body().as_ref(), output).map_err(crate::error::AnalyzeExpenseError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidParameterException" => crate::error::AnalyzeExpenseError {
meta: generic,
kind: crate::error::AnalyzeExpenseErrorKind::InvalidParameterException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_parameter_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_parameter_exception_json_err(response.body().as_ref(), output).map_err(crate::error::AnalyzeExpenseError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"InvalidS3ObjectException" => crate::error::AnalyzeExpenseError {
meta: generic,
kind: crate::error::AnalyzeExpenseErrorKind::InvalidS3ObjectException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::invalid_s3_object_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_invalid_s3_object_exception_json_err(response.body().as_ref(), output).map_err(crate::error::AnalyzeExpenseError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ProvisionedThroughputExceededException" => crate::error::AnalyzeExpenseError {
meta: generic,
kind: crate::error::AnalyzeExpenseErrorKind::ProvisionedThroughputExceededException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::provisioned_throughput_exceeded_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_provisioned_throughput_exceeded_exception_json_err(response.body().as_ref(), output).map_err(crate::error::AnalyzeExpenseError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"ThrottlingException" => crate::error::AnalyzeExpenseError {
meta: generic,
kind: crate::error::AnalyzeExpenseErrorKind::ThrottlingException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::error::throttling_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_throttling_exception_json_err(response.body().as_ref(), output).map_err(crate::error::AnalyzeExpenseError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
"UnsupportedDocumentException" => crate::error::AnalyzeExpenseError {
meta: generic,
kind: crate::error::AnalyzeExpenseErrorKind::UnsupportedDocumentException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output =
crate::error::unsupported_document_exception::Builder::default();
let _ = response;
output = crate::json_deser::deser_structure_crate_error_unsupported_document_exception_json_err(response.body().as_ref(), output).map_err(crate::error::AnalyzeExpenseError::unhandled)?;
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
},
_ => crate::error::AnalyzeExpenseError::generic(generic),
})
}
sourcepub fn meta(&self) -> &Error
pub fn meta(&self) -> &Error
Returns error metadata, which includes the error code, message, request ID, and potentially additional information.
sourcepub fn request_id(&self) -> Option<&str>
pub fn request_id(&self) -> Option<&str>
Returns the request ID if it’s available.
sourcepub fn is_access_denied_exception(&self) -> bool
pub fn is_access_denied_exception(&self) -> bool
Returns true
if the error kind is AnalyzeExpenseErrorKind::AccessDeniedException
.
sourcepub fn is_bad_document_exception(&self) -> bool
pub fn is_bad_document_exception(&self) -> bool
Returns true
if the error kind is AnalyzeExpenseErrorKind::BadDocumentException
.
sourcepub fn is_document_too_large_exception(&self) -> bool
pub fn is_document_too_large_exception(&self) -> bool
Returns true
if the error kind is AnalyzeExpenseErrorKind::DocumentTooLargeException
.
sourcepub fn is_internal_server_error(&self) -> bool
pub fn is_internal_server_error(&self) -> bool
Returns true
if the error kind is AnalyzeExpenseErrorKind::InternalServerError
.
sourcepub fn is_invalid_parameter_exception(&self) -> bool
pub fn is_invalid_parameter_exception(&self) -> bool
Returns true
if the error kind is AnalyzeExpenseErrorKind::InvalidParameterException
.
sourcepub fn is_invalid_s3_object_exception(&self) -> bool
pub fn is_invalid_s3_object_exception(&self) -> bool
Returns true
if the error kind is AnalyzeExpenseErrorKind::InvalidS3ObjectException
.
sourcepub fn is_provisioned_throughput_exceeded_exception(&self) -> bool
pub fn is_provisioned_throughput_exceeded_exception(&self) -> bool
Returns true
if the error kind is AnalyzeExpenseErrorKind::ProvisionedThroughputExceededException
.
sourcepub fn is_throttling_exception(&self) -> bool
pub fn is_throttling_exception(&self) -> bool
Returns true
if the error kind is AnalyzeExpenseErrorKind::ThrottlingException
.
sourcepub fn is_unsupported_document_exception(&self) -> bool
pub fn is_unsupported_document_exception(&self) -> bool
Returns true
if the error kind is AnalyzeExpenseErrorKind::UnsupportedDocumentException
.