logo
pub struct LaunchError { /* private fields */ }
Expand description

An error that occurs during launch.

A LaunchError is returned by launch() when launching an application fails.

Panics

A value of this type panics if it is dropped without first being inspected. An inspection occurs when any method is called. For instance, if println!("Error: {}", e) is called, where e: LaunchError, the Display::fmt method being called by println! results in e being marked as inspected; a subsequent drop of the value will not result in a panic. The following snippet illustrates this:

let error = rocket::ignite().launch();

// This line is only reached if launching failed. This "inspects" the error.
println!("Launch failed! Error: {}", error);

// This call to drop (explicit here for demonstration) will do nothing.
drop(error);

When a value of this type panics, the corresponding error message is pretty printed to the console. The following illustrates this:

let error = rocket::ignite().launch();

// This call to drop (explicit here for demonstration) will result in
// `error` being pretty-printed to the console along with a `panic!`.
drop(error);

Usage

A LaunchError value should usually be allowed to drop without inspection. There are two exceptions to this suggestion.

  1. If you are writing a library or high-level application on-top of Rocket, you likely want to inspect the value before it drops to avoid a Rocket-specific panic!. This typically means simply printing the value.

  2. You want to display your own error messages.

Implementations

Retrieve the kind of the launch error.

Example
let error = rocket::ignite().launch();

// This line is only reached if launch failed.
let error_kind = error.kind();

Trait Implementations

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

The lower-level source of this error, if any. Read more

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Converts to this type from the input type.

Converts to this type from the input type.

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.

Calls U::from(self).

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

Converts self into a collection.

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.

Get the TypeId of this object.