Skip to main content

LivewireError

Enum LivewireError 

Source
pub enum LivewireError {
Show 32 variants MissingHeader, NotJson { content_type: Option<String>, }, MalformedPayload(String), InvalidSnapshot, ModelNotFound { class: String, key: String, }, Database { message: String, }, ValidationFailed { errors: Map<String, Value>, }, PolicyFailed { method: String, message: String, }, MixedParameters, InvalidRouteContext(String), DefaultUpdateUriOverridden, CorruptPayload, ReleaseTokenMismatch, MethodNotFound { method: String, }, LockedProperty { property: String, component: String, }, HydrationFailed { property: String, component: String, message: String, }, TooManyChecksumFailures { retry_after: u64, }, ComponentNotFound { name: String, }, SynthNotFound { key: String, }, UnknownProperty { property: String, component: String, }, PayloadTooLarge { size: usize, max: usize, }, TooManyComponents { count: usize, max: usize, }, TooManyCalls { count: usize, max: usize, }, NestingDepthExceeded { path: String, max: usize, }, RootTagMissing, MultipleRootElements { name: String, }, EventListenerMissing { event: String, }, Unauthorized { method: String, }, InvalidUploadSignature, InvalidSignedReference, UploadValidation(String), ViewNotFound { view: String, },
}
Expand description

Something a Livewire request can go wrong with.

Variants§

§

MissingHeader

The update request has no X-Livewire header, so it did not come from the client.

§

NotJson

The update request’s content type is not JSON.

Fields

§content_type: Option<String>

The content type the request sent, or None when it sent none.

§

MalformedPayload(String)

The request body is not the JSON object the protocol defines.

§

InvalidSnapshot

A component’s snapshot is not the structure the protocol defines.

§

ModelNotFound

A model reference names a row that no longer exists.

Fields

§class: String

The model’s class name, as the wire names it.

§key: String

The key the reference carried.

§

Database

A database query the framework ran for a component failed.

Fields

§message: String

What the framework reported.

§

ValidationFailed

A validation rule rejected the component’s state. The browser reads the messages from the snapshot, so this error is not an HTTP failure of its own: the response still renders.

Fields

§errors: Map<String, Value>

The messages, keyed by field.

§

PolicyFailed

An action’s policy failed, which is a server fault rather than a refusal: a policy that refuses returns Ok(false).

Fields

§method: String

The method whose policy failed.

§message: String

What the policy reported.

§

MixedParameters

A call’s parameters mix positional and named parameters.

§

InvalidRouteContext(String)

The snapshot’s path, method, or route does not match the request that arrived.

§

DefaultUpdateUriOverridden

A custom update URI is configured, so the default route answers nothing.

§

CorruptPayload

The snapshot’s checksum does not match its contents.

§

ReleaseTokenMismatch

The snapshot was made by another deployment.

§

MethodNotFound

A call names a method the component does not publish.

Fields

§method: String

The method the call named.

§

LockedProperty

An update sets a property the component locked.

Fields

§property: String

The property the update named.

§component: String

The component the update named.

§

HydrationFailed

A value cannot be hydrated into the field it belongs to.

Fields

§property: String

The property being hydrated.

§component: String

The component being hydrated.

§message: String

What the value could not be read as.

§

TooManyChecksumFailures

The client sent too many corrupt snapshots.

Fields

§retry_after: u64

How many seconds until the client may send another request.

§

ComponentNotFound

The snapshot names a component the registry does not hold.

Fields

§name: String

The component name the snapshot holds.

§

SynthNotFound

A snapshot or update names a synthesizer the registry does not hold.

Fields

§key: String

The synthesizer key that could not be resolved.

§

UnknownProperty

An update sets a property that is not public on the wire.

Fields

§property: String

The property the update named.

§component: String

The component the update named.

§

PayloadTooLarge

The request body is larger than the configured limit.

Fields

§size: usize

The size of the request body, in bytes.

§max: usize

The configured limit, in bytes.

§

TooManyComponents

The request updates more components than the configured limit.

Fields

§count: usize

How many components the request updated.

§max: usize

The configured limit.

§

TooManyCalls

The request makes more calls than the configured limit.

Fields

§count: usize

How many calls the request made.

§max: usize

The configured limit.

§

NestingDepthExceeded

An update sets a property path deeper than the configured limit.

Fields

§path: String

The property path the update set.

§max: usize

The configured limit.

§

RootTagMissing

A component’s view rendered no HTML element.

§

MultipleRootElements

A component’s view rendered more than one HTML element.

Fields

§name: String

The component that rendered several elements.

§

EventListenerMissing

The browser dispatched an event the component does not listen for.

Fields

§event: String

The event the browser dispatched.

§

Unauthorized

The component’s policy denied the action.

Fields

§method: String

The action that was denied.

§

InvalidUploadSignature

The upload endpoint’s URL signature is invalid or expired.

§

InvalidSignedReference

A temporary file reference is invalid or expired.

§

UploadValidation(String)

A temporary upload failed its validation.

§

ViewNotFound

A component resolved to a view that does not exist.

Fields

§view: String

The view the component named.

Implementations§

Source§

impl LivewireError

Source

pub fn status(&self) -> StatusCode

The status the browser receives.

§Panics

Panics when 419 stops being a status code, which a Rust update would only do by breaking the protocol’s own contract.

Source

pub const fn renders_framework_error(&self) -> bool

Whether upstream Livewire lets the framework render its debug page for this error instead of answering with the bare status. In production the status alone is the answer, so that a probing client learns nothing about the failure.

Source

pub fn message(&self) -> String

The message the browser receives in debug mode, and that the server logs otherwise.

Source

pub fn into_response(self, debug: bool) -> Response

The response for this error. In debug mode, errors upstream renders as a page answer with the framework’s detailed error page; every other error answers with its status and, for a 429, the retry information.

Trait Implementations§

Source§

impl Clone for LivewireError

Source§

fn clone(&self) -> Self

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 LivewireError

Source§

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

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

impl Display for LivewireError

Source§

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

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

impl Eq for LivewireError

Source§

impl Error for LivewireError

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

Replaced by Error::source.
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 LivewireError

Source§

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

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

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

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

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> IntoMarkdown for T
where T: Display,

Source§

fn into_markdown(self) -> Markdown

The value as Slack markdown.
Source§

fn __format(self, format: impl FnOnce(&dyn Display) -> String) -> Markdown

Source§

impl<T, N> NotifiedBy<T> for N
where T: Notification<N>,

Source§

fn __routes(&self) -> Vec<Route>

Source§

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

Source§

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

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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