#[non_exhaustive]
pub struct HeadObjectError { pub kind: HeadObjectErrorKind, /* private fields */ }
Expand description

Error type for the HeadObject operation.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§kind: HeadObjectErrorKind

Kind of error that occurred.

Implementations§

Creates a new HeadObjectError.

Creates the HeadObjectError::Unhandled variant from any error type.

Examples found in repository?
src/operation_deser.rs (line 2263)
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
pub fn parse_head_object_error(
    response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::HeadObjectOutput, crate::error::HeadObjectError> {
    let generic = crate::xml_deser::parse_http_generic_error(response)
        .map_err(crate::error::HeadObjectError::unhandled)?;
    let error_code = match generic.code() {
        Some(code) => code,
        None => return Err(crate::error::HeadObjectError::unhandled(generic)),
    };

    let _error_message = generic.message().map(|msg| msg.to_owned());
    Err(match error_code {
        "NotFound" => crate::error::HeadObjectError {
            meta: generic,
            kind: crate::error::HeadObjectErrorKind::NotFound({
                #[allow(unused_mut)]
                let mut tmp = {
                    #[allow(unused_mut)]
                    let mut output = crate::error::not_found::Builder::default();
                    let _ = response;
                    output = crate::xml_deser::deser_structure_crate_error_not_found_xml_err(
                        response.body().as_ref(),
                        output,
                    )
                    .map_err(crate::error::HeadObjectError::unhandled)?;
                    output.build()
                };
                if tmp.message.is_none() {
                    tmp.message = _error_message;
                }
                tmp
            }),
        },
        _ => crate::error::HeadObjectError::generic(generic),
    })
}

#[allow(clippy::unnecessary_wraps)]
pub fn parse_head_object_response(
    response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::HeadObjectOutput, crate::error::HeadObjectError> {
    Ok({
        #[allow(unused_mut)]
        let mut output = crate::output::head_object_output::Builder::default();
        let _ = response;
        output = output.set_accept_ranges(
            crate::http_serde::deser_header_head_object_head_object_output_accept_ranges(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse AcceptRanges from header `accept-ranges",
                )
            })?,
        );
        output = output.set_archive_status(
            crate::http_serde::deser_header_head_object_head_object_output_archive_status(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse ArchiveStatus from header `x-amz-archive-status",
                )
            })?,
        );
        output = output.set_bucket_key_enabled(
            crate::http_serde::deser_header_head_object_head_object_output_bucket_key_enabled(response.headers())
                                    .map_err(|_|crate::error::HeadObjectError::unhandled("Failed to parse BucketKeyEnabled from header `x-amz-server-side-encryption-bucket-key-enabled"))?
        );
        output = output.set_cache_control(
            crate::http_serde::deser_header_head_object_head_object_output_cache_control(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse CacheControl from header `Cache-Control",
                )
            })?,
        );
        output = output.set_checksum_crc32(
            crate::http_serde::deser_header_head_object_head_object_output_checksum_crc32(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse ChecksumCRC32 from header `x-amz-checksum-crc32",
                )
            })?,
        );
        output = output.set_checksum_crc32_c(
            crate::http_serde::deser_header_head_object_head_object_output_checksum_crc32_c(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse ChecksumCRC32C from header `x-amz-checksum-crc32c",
                )
            })?,
        );
        output = output.set_checksum_sha1(
            crate::http_serde::deser_header_head_object_head_object_output_checksum_sha1(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse ChecksumSHA1 from header `x-amz-checksum-sha1",
                )
            })?,
        );
        output = output.set_checksum_sha256(
            crate::http_serde::deser_header_head_object_head_object_output_checksum_sha256(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse ChecksumSHA256 from header `x-amz-checksum-sha256",
                )
            })?,
        );
        output = output.set_content_disposition(
            crate::http_serde::deser_header_head_object_head_object_output_content_disposition(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse ContentDisposition from header `Content-Disposition",
                )
            })?,
        );
        output = output.set_content_encoding(
            crate::http_serde::deser_header_head_object_head_object_output_content_encoding(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse ContentEncoding from header `Content-Encoding",
                )
            })?,
        );
        output = output.set_content_language(
            crate::http_serde::deser_header_head_object_head_object_output_content_language(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse ContentLanguage from header `Content-Language",
                )
            })?,
        );
        output = output.set_content_length(
            crate::http_serde::deser_header_head_object_head_object_output_content_length(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse ContentLength from header `Content-Length",
                )
            })?,
        );
        output = output.set_content_type(
            crate::http_serde::deser_header_head_object_head_object_output_content_type(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse ContentType from header `Content-Type",
                )
            })?,
        );
        output = output.set_delete_marker(
            crate::http_serde::deser_header_head_object_head_object_output_delete_marker(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse DeleteMarker from header `x-amz-delete-marker",
                )
            })?,
        );
        output = output.set_e_tag(
            crate::http_serde::deser_header_head_object_head_object_output_e_tag(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled("Failed to parse ETag from header `ETag")
            })?,
        );
        output = output.set_expiration(
            crate::http_serde::deser_header_head_object_head_object_output_expiration(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse Expiration from header `x-amz-expiration",
                )
            })?,
        );
        output = output.set_expires(
            crate::http_serde::deser_header_head_object_head_object_output_expires(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse Expires from header `Expires",
                )
            })?,
        );
        output = output.set_last_modified(
            crate::http_serde::deser_header_head_object_head_object_output_last_modified(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse LastModified from header `Last-Modified",
                )
            })?,
        );
        output = output.set_metadata(
            crate::http_serde::deser_prefix_header_head_object_head_object_output_metadata(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse Metadata from prefix header `x-amz-meta-",
                )
            })?,
        );
        output = output.set_missing_meta(
            crate::http_serde::deser_header_head_object_head_object_output_missing_meta(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse MissingMeta from header `x-amz-missing-meta",
                )
            })?,
        );
        output = output.set_object_lock_legal_hold_status(
            crate::http_serde::deser_header_head_object_head_object_output_object_lock_legal_hold_status(response.headers())
                                    .map_err(|_|crate::error::HeadObjectError::unhandled("Failed to parse ObjectLockLegalHoldStatus from header `x-amz-object-lock-legal-hold"))?
        );
        output = output.set_object_lock_mode(
            crate::http_serde::deser_header_head_object_head_object_output_object_lock_mode(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse ObjectLockMode from header `x-amz-object-lock-mode",
                )
            })?,
        );
        output = output.set_object_lock_retain_until_date(
            crate::http_serde::deser_header_head_object_head_object_output_object_lock_retain_until_date(response.headers())
                                    .map_err(|_|crate::error::HeadObjectError::unhandled("Failed to parse ObjectLockRetainUntilDate from header `x-amz-object-lock-retain-until-date"))?
        );
        output = output.set_parts_count(
            crate::http_serde::deser_header_head_object_head_object_output_parts_count(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse PartsCount from header `x-amz-mp-parts-count",
                )
            })?,
        );
        output = output.set_replication_status(
            crate::http_serde::deser_header_head_object_head_object_output_replication_status(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse ReplicationStatus from header `x-amz-replication-status",
                )
            })?,
        );
        output = output.set_request_charged(
            crate::http_serde::deser_header_head_object_head_object_output_request_charged(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse RequestCharged from header `x-amz-request-charged",
                )
            })?,
        );
        output = output.set_restore(
            crate::http_serde::deser_header_head_object_head_object_output_restore(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse Restore from header `x-amz-restore",
                )
            })?,
        );
        output = output.set_sse_customer_algorithm(
            crate::http_serde::deser_header_head_object_head_object_output_sse_customer_algorithm(response.headers())
                                    .map_err(|_|crate::error::HeadObjectError::unhandled("Failed to parse SSECustomerAlgorithm from header `x-amz-server-side-encryption-customer-algorithm"))?
        );
        output = output.set_sse_customer_key_md5(
            crate::http_serde::deser_header_head_object_head_object_output_sse_customer_key_md5(response.headers())
                                    .map_err(|_|crate::error::HeadObjectError::unhandled("Failed to parse SSECustomerKeyMD5 from header `x-amz-server-side-encryption-customer-key-MD5"))?
        );
        output = output.set_ssekms_key_id(
            crate::http_serde::deser_header_head_object_head_object_output_ssekms_key_id(response.headers())
                                    .map_err(|_|crate::error::HeadObjectError::unhandled("Failed to parse SSEKMSKeyId from header `x-amz-server-side-encryption-aws-kms-key-id"))?
        );
        output = output.set_server_side_encryption(
            crate::http_serde::deser_header_head_object_head_object_output_server_side_encryption(response.headers())
                                    .map_err(|_|crate::error::HeadObjectError::unhandled("Failed to parse ServerSideEncryption from header `x-amz-server-side-encryption"))?
        );
        output = output.set_storage_class(
            crate::http_serde::deser_header_head_object_head_object_output_storage_class(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse StorageClass from header `x-amz-storage-class",
                )
            })?,
        );
        output = output.set_version_id(
            crate::http_serde::deser_header_head_object_head_object_output_version_id(
                response.headers(),
            )
            .map_err(|_| {
                crate::error::HeadObjectError::unhandled(
                    "Failed to parse VersionId from header `x-amz-version-id",
                )
            })?,
        );
        output = output.set_website_redirect_location(
            crate::http_serde::deser_header_head_object_head_object_output_website_redirect_location(response.headers())
                                    .map_err(|_|crate::error::HeadObjectError::unhandled("Failed to parse WebsiteRedirectLocation from header `x-amz-website-redirect-location"))?
        );
        output.build()
    })
}

Creates the HeadObjectError::Unhandled variant from a aws_smithy_types::Error.

Examples found in repository?
src/operation_deser.rs (line 2289)
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
pub fn parse_head_object_error(
    response: &http::Response<bytes::Bytes>,
) -> std::result::Result<crate::output::HeadObjectOutput, crate::error::HeadObjectError> {
    let generic = crate::xml_deser::parse_http_generic_error(response)
        .map_err(crate::error::HeadObjectError::unhandled)?;
    let error_code = match generic.code() {
        Some(code) => code,
        None => return Err(crate::error::HeadObjectError::unhandled(generic)),
    };

    let _error_message = generic.message().map(|msg| msg.to_owned());
    Err(match error_code {
        "NotFound" => crate::error::HeadObjectError {
            meta: generic,
            kind: crate::error::HeadObjectErrorKind::NotFound({
                #[allow(unused_mut)]
                let mut tmp = {
                    #[allow(unused_mut)]
                    let mut output = crate::error::not_found::Builder::default();
                    let _ = response;
                    output = crate::xml_deser::deser_structure_crate_error_not_found_xml_err(
                        response.body().as_ref(),
                        output,
                    )
                    .map_err(crate::error::HeadObjectError::unhandled)?;
                    output.build()
                };
                if tmp.message.is_none() {
                    tmp.message = _error_message;
                }
                tmp
            }),
        },
        _ => crate::error::HeadObjectError::generic(generic),
    })
}

Returns the error message if one is available.

Returns error metadata, which includes the error code, message, request ID, and potentially additional information.

Returns the request ID if it’s available.

Returns the error code if it’s available.

Examples found in repository?
src/error.rs (line 5926)
5925
5926
5927
    fn code(&self) -> Option<&str> {
        HeadObjectError::code(self)
    }

Returns true if the error kind is HeadObjectErrorKind::NotFound.

Trait Implementations§

Creates an unhandled error variant with the given source.
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
The lower-level source of this error, if any. Read more
👎Deprecated since 1.42.0: use the Display impl or to_string()
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
Converts to this type from the input type.
Returns the code for this error if one exists
Returns the ErrorKind when the error is modeled as retryable Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to provide by using demand. Read more
Should always be Self
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more