1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
//! Google Maps Platform API error types and error messages.
// -----------------------------------------------------------------------------
use miette::Diagnostic;
use thiserror::Error;
// -----------------------------------------------------------------------------
//
/// Errors that may be produced by the root part of the Google Maps Platform API
/// client.
#[derive(Debug, Diagnostic, Error)]
#[diagnostic(url(docsrs))]
pub enum Error {
/// Error originating from the types and structs in the `google_maps` crate.
#[error(transparent)]
#[diagnostic(code(google_maps::types))]
Type(#[from] crate::types::Error),
/// Error originating from the `directions` module in the `google_maps`
/// crate.
#[cfg(any(feature = "directions", feature = "distance_matrix"))]
#[error(transparent)]
#[diagnostic(code(google_maps::directions))]
Directions(#[from] crate::directions::error::Error),
/// Error originating from the `distance_matrix` module in the `google_maps`
/// crate.
#[cfg(feature = "distance_matrix")]
#[error(transparent)]
#[diagnostic(code(google_maps::distance_matrix))]
DistanceMatrix(#[from] crate::distance_matrix::error::Error),
/// Error originating from the `elevation` module in the `google_maps`
/// crate.
#[cfg(feature = "elevation")]
#[error(transparent)]
#[diagnostic(code(google_maps::elevation))]
Elevation(#[from] crate::elevation::error::Error),
/// Error originating from the `geocoding` module in the `google_maps`
/// crate.
#[cfg(feature = "geocoding")]
#[error(transparent)]
#[diagnostic(code(google_maps::geocoding))]
Geocoding(#[from] crate::geocoding::error::Error),
/// Error originating from the `places` module in the `google_maps` crate.
#[cfg(feature = "places")]
#[error(transparent)]
#[diagnostic(code(google_maps::places))]
Places(#[from] crate::places::error::Error),
/// Error originating from the `place_autocomplete` module in the
/// `google_maps` crate.
#[cfg(feature = "autocomplete")]
#[error(transparent)]
#[diagnostic(code(google_maps::place_autocomplete))]
PlaceAutocomplete(#[from] crate::places::place_autocomplete::error::Error),
/// Error originating from the `roads` module in the `google_maps` crate.
#[cfg(feature = "roads")]
#[error(transparent)]
#[diagnostic(code(google_maps::roads))]
Roads(#[from] crate::roads::error::Error),
/// Error originating from the `time_zone` module in the `google_maps`
/// crate.
#[cfg(feature = "time_zone")]
#[error(transparent)]
#[diagnostic(code(google_maps::time_zone))]
TimeZone(#[from] crate::time_zone::error::Error),
} // enum Error