Enum telescope::error::TelescopeError[][src]

pub enum TelescopeError {
Show 19 variants PageNotFound, ResourceNotFound { header: String, message: String, }, GatewayError { header: String, message: String, }, RenderingError(RenderError), FutureCanceled, InternalServerError(String), BadRequest { header: String, message: String, show_status_code: bool, }, NotImplemented, IpExtractionError, CsrfTokenNotFound, CsrfTokenMismatch, RcosApiError(String), GitHubApiError(String), SerenityError(String), GraphQLError { platform: String, errors: Vec<GraphQlError>, }, InvalidForm(Page), NotAuthenticated, Forbidden, RpiCasError(String),
}
Expand description

All major errors that can occur while responding to a request.

Variants

PageNotFound

404 - Page not found. Use TelescopeError::ResourceNotFound instead when possible, as it will have more info.

ResourceNotFound

Fields

header: String

The header of the jumbotron to be displayed.

message: String

The message to display under the jumbotron.

404 - Resource Not Found.

GatewayError

Fields

header: String

The header on the jumbotron to be displayed.

message: String

The message on the jumbotron to be displayed.

Upstream server returned error. This is usually when adding users to the RCOS Discord.

RenderingError(RenderError)

Tuple Fields

An error in rendering a handlebars template. This will report as an internal server error.

FutureCanceled

An internal future was canceled unexpectedly. This will always report as an internal server error.

InternalServerError(String)

Tuple Fields

0: String

There was an internal server error.

BadRequest

Fields

header: String

The header of the jumbotron to be displayed.

message: String

The error message to be displayed under the jumbotron.

show_status_code: bool

Should the response status code be shown to the user?

The request was malformed.

NotImplemented

Error to send when user accesses something that is not yet implemented.

IpExtractionError

Error saving CSRF Token. This should report as an internal server error

CsrfTokenNotFound

CSRF Token not found. This reports a Not Found status code but should usually be caught before reaching the user (if expected).

CsrfTokenMismatch

The CSRF token provided by the HTTP request did not match the one generated by the server. This should be reported as a bad request.

RcosApiError(String)

Tuple Fields

0: String

Error interacting with RCOS central API. This should generally report as an ISE.

GitHubApiError(String)

Tuple Fields

0: String

Error interacting with GitHub’s GraphQL API. This should generally report as an ISE.

SerenityError(String)

Tuple Fields

0: String

Error interacting with the Discord API via Serenity. This should report as an ISE or a gateway error.

GraphQLError

Fields

platform: String

The API platform

errors: Vec<GraphQlError>

The errors that were returned.

A GraphQL API responded with errors. This should report as an internal server error.

InvalidForm(Page)

Tuple Fields

0: Page

The user submitted invalid data to a form. This should be reported as a bad request and the form should be displayed for the user to try again. The value here is the page to be displayed to the user.

NotAuthenticated

An unauthenticated user is trying to access a page that requires authentication. Report as unauthorized and direct them to try again.

Forbidden

An authenticated user tried to access a resource that they do not have sufficient permissions to access.

RpiCasError(String)

Tuple Fields

0: String

Error sending to or receiving from the RPI CAS system. This should report as a Gateway error.

Implementations

Create a resource not found error with converted fields.

Construct an Internal Server Error and convert the message.

Convert a reqwest error from the RCOS API into a telescope error.

Convert a reqwest error from the GitHub API into a telescope error.

Convert a Serenity error into a Telescope error.

Convert reqwest error from RPI CAS service into a Telescope error.

Function that should only be used by the middleware to render a telescope error into an error page.

Trait Implementations

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

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.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Performs the conversion.

Performs the conversion.

Response’s status code Read more

Create response for error Read more

Serialize this value into the given Serde serializer. Read more

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

Performs the conversion.

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

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

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

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

Performs the conversion.

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.

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

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