Skip to main content

ErrorCode

Enum ErrorCode 

Source
#[non_exhaustive]
pub enum ErrorCode {
Show 18 variants Unauthenticated, InvalidApiKey, InvalidToken, Forbidden, Suspended, NotFound, Conflict, ManagedRecord, ManagedCertificate, Validation, ImportFailed, DiscoveryFailed, PayloadTooLarge, AuditDisabled, TelemetryDisabled, BadRequest, Internal, Other(String),
}
Expand description

error.code values Core sends (../core/src/api/errors.ts, auth.ts). Unknown codes are kept as ErrorCode::Other so a newer Core never breaks parsing.

Non-exhaustive: new Core codes get their own variant in later SDK versions, so a match needs a wildcard arm.

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.
§

Unauthenticated

401: no credentials were sent (the client was built without an API key).

§

InvalidApiKey

401: the API key is unknown, was replaced or was revoked.

§

InvalidToken

401: the bearer token was taken as a JWT and rejected. Core takes anything without the dz_/du_ prefix for a JWT, so this usually means a key Core did not issue (see ApiKeyKind::of).

§

Forbidden

403: the key may not do this (wrong zone, not the owner, missing scope).

§

Suspended

403: the zone or client identity is suspended by an Admin (itself or through its owner). Reads still work, and so does deleting it; for a zone also removing a member and revoking its key.

§

NotFound

404: the resource does not exist, or is not visible to the key.

§

Conflict

409: already exists, still referenced, or a zone rule is violated (see ApiError::details).

§

ManagedRecord

409: the record value is kept by Core for a redirect or a certificate issuance (RecordValue::managed_by), or a user A/AAAA/CNAME would go where a redirect is. ApiError::details is {managed_by, name}; change the redirect instead.

§

ManagedCertificate

409: the certificate was issued automatically for a redirect (source: Acme) and cannot be replaced or deleted directly. ApiError::details is {managed_by, name} with the redirect’s name; change the redirect’s tls instead.

§

Validation

422: the input failed validation; ApiError::details lists the issues.

§

ImportFailed

422: a zone import refused some records, so nothing was written; ApiError::import_report has the full report.

§

DiscoveryFailed

422: zone discovery found no usable nameserver (typically the delegation already points to Dinio: give the previous provider’s nameservers).

§

PayloadTooLarge

413: the uploaded file is too large (zone import: 2 MiB).

§

AuditDisabled

503: this Core runs without the audit log.

§

TelemetryDisabled

503: this Core runs without telemetry, so there are no statistics.

§

BadRequest

400: the request body is not valid JSON.

§

Internal

500: an unexpected error inside Core.

§

Other(String)

A code this SDK version does not know yet, kept verbatim.

Implementations§

Source§

impl ErrorCode

Source

pub fn from_wire(code: &str) -> Self

Parses Core’s error.code; unknown codes become ErrorCode::Other.

Source

pub fn as_wire(&self) -> &str

The code as Core sends it (NOT_FOUND).

Trait Implementations§

Source§

impl Clone for ErrorCode

Source§

fn clone(&self) -> ErrorCode

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 ErrorCode

Source§

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

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

impl Display for ErrorCode

Source§

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

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

impl Eq for ErrorCode

Source§

impl PartialEq for ErrorCode

Source§

fn eq(&self, other: &ErrorCode) -> 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 ErrorCode

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<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
§

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

§

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

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

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

§

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

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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.

§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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