Skip to main content

ProjError

Enum ProjError 

Source
#[non_exhaustive]
pub enum ProjError {
Show 23 variants InvalidOp, WrongSyntax, MissingArg, IllegalArgValue, MutuallyExclusiveArgs, FileNotFound, NotEllipsoid, CoordTransfm, InvalidCoord, OutsideProjectionDomain, NoOperation, OutsideGrid, GridAtNodata, NoConvergence, MissingTime, InvalidCrs { message: String, suggestion: Option<String>, }, OutOfBounds { message: String, suggestion: Option<String>, }, ProjectionFailed { message: String, }, UnsupportedOperation, Other, ApiMisuse, NoInverseOp, NetworkError,
}
Expand description

Error type mirroring PROJ’s PROJ_ERR_* codes.

The numeric codes are grouped by base values defined in src/proj.h:

  • PROJ_ERR_INVALID_OP (1024): invalid operation / wrong setup.
  • PROJ_ERR_COORD_TRANSFM (2048): coordinate transformation failures.
  • PROJ_ERR_OTHER (4096): all other errors.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

InvalidOp

Generic invalid operation (PROJ_ERR_INVALID_OP = 1024).

§

WrongSyntax

Invalid PROJ string syntax (PROJ_ERR_INVALID_OP_WRONG_SYNTAX = 1025).

§

MissingArg

Missing required operation parameter (PROJ_ERR_INVALID_OP_MISSING_ARG = 1026).

§

IllegalArgValue

One of the operation parameters has an illegal value (PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE = 1027).

§

MutuallyExclusiveArgs

Mutually exclusive arguments (PROJ_ERR_INVALID_OP_MUTUALLY_EXCLUSIVE_ARGS = 1028).

§

FileNotFound

File not found or with invalid content (PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID = 1029).

§

NotEllipsoid

Value does not correspond to an ellipsoid (maps to code 1027, same as ProjError::IllegalArgValue).

§

CoordTransfm

Generic error of coordinate transformation (PROJ_ERR_COORD_TRANSFM = 2048).

§

InvalidCoord

Invalid coordinate (PROJ_ERR_COORD_TRANSFM_INVALID_COORD = 2049).

§

OutsideProjectionDomain

Coordinate outside projection domain (PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN = 2050).

§

NoOperation

No operation found matching criteria (PROJ_ERR_COORD_TRANSFM_NO_OPERATION = 2051).

§

OutsideGrid

Point to transform falls outside grid or subgrid (PROJ_ERR_COORD_TRANSFM_OUTSIDE_GRID = 2052).

§

GridAtNodata

Point to transform falls in a grid cell that evaluates to nodata (PROJ_ERR_COORD_TRANSFM_GRID_AT_NODATA = 2053).

§

NoConvergence

Iterative algorithm did not converge (PROJ_ERR_COORD_TRANSFM_NO_CONVERGENCE = 2054).

§

MissingTime

Missing required time coordinate (PROJ_ERR_COORD_TRANSFM_MISSING_TIME = 2055).

§

InvalidCrs

Invalid CRS definition with a descriptive message.

Use this variant when the error is specifically a CRS definition problem and you can provide a helpful message (and optionally a suggestion for fixing it).

Fields

§message: String

Human-readable description of the problem.

§suggestion: Option<String>

Optional suggestion for resolving the error.

§

OutOfBounds

Coordinate out of bounds.

Carries a descriptive message and an optional suggestion.

Fields

§message: String

Human-readable description of the problem.

§suggestion: Option<String>

Optional suggestion for resolving the error.

§

ProjectionFailed

Projection computation failed.

Carries a descriptive message about the computation failure.

Fields

§message: String

Human-readable description of the failure.

§

UnsupportedOperation

Operation not supported (e.g. AD path not implemented for this projection).

§

Other

Other error (PROJ_ERR_OTHER = 4096).

§

ApiMisuse

Error caused by incorrect use of PROJ API (PROJ_ERR_OTHER_API_MISUSE = 4097).

§

NoInverseOp

No inverse operation (PROJ_ERR_OTHER_NO_INVERSE_OP = 4098).

§

NetworkError

Failure when accessing a network resource (PROJ_ERR_OTHER_NETWORK_ERROR = 4099).

Implementations§

Source§

impl ProjError

Source

pub fn code(&self) -> i32

Ported from src/proj.h (PROJ_ERR_* numeric codes)

Source

pub fn suggestion(&self) -> Option<&str>

Returns a human-readable suggestion for resolving this error, if one is available.

Returns Some for variants that carry a suggestion field (when one was provided at construction time) as well as for several well-known unit variants where a static hint is always useful.

Trait Implementations§

Source§

impl Clone for ProjError

Source§

fn clone(&self) -> ProjError

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProjError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ProjError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ProjError

Source§

impl Error for ProjError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for ProjError

Source§

fn eq(&self, other: &ProjError) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ProjError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

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

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more