pub struct JsonError {
    pub status: u16,
    pub title: String,
    pub message: String,
    pub request_id: RequestId,
    pub correlation_id: Option<String>,
    pub honeycomb_trace_id: Option<String>,
}
Expand description

The structure of an error as formatted by preroll’s error handling middleware.

A service using preroll will always respond with a JSON body in this format if an internal or client error occurs.

An example of the structure as it would be in JSON:

{
  "status": 422,
  "title": "Unprocessable Entity",
  "message": "missing field \"address\"",
  "request_id": "00000000-0000-0000-0000-000000000000"
  "correlation_id": null,
}

Fields

status: u16

The http status code. Refer to httpstatuses.com for a nice reference.

title: String

The ‘canonical reason’ of the http status code as specified in rfc7231 section 6.1, implemented via http_types::StatusCode.

message: String

The origin error message for 4XX client errors.

In case of an 5XX internal server error, this field will be "Internal Server Error (correlation_id=00000000-0000-0000-0000-000000000000)".

If the original error context is missing, this field will be "(no additional context)".

request_id: RequestId

The UUID v4 assigned to the request, possibly from an incoming header.

correlation_id: Option<String>

The service-unique UUID v4 assigned to the error response for 5XX internal server errors.

honeycomb_trace_id: Option<String>
This is supported on crate feature honeycomb only.

If the honeycomb feature is enabled, this will be the honeycomb trace id associated with this request.

Trait Implementations

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. 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

Returns the argument unchanged.

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

Calls U::from(self).

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

Set the foreground color generically Read more

Set the background color generically. Read more

Change the foreground color to black

Change the foreground color to black

Change the foreground color to red

Change the foreground color to red

Change the foreground color to green

Change the foreground color to green

Change the foreground color to yellow

Change the foreground color to yellow

Change the foreground color to blue

Change the foreground color to blue

Change the foreground color to magenta

Change the foreground color to magenta

Change the foreground color to purple

Change the foreground color to purple

Change the foreground color to cyan

Change the foreground color to cyan

Change the foreground color to white

Change the foreground color to white

Change the foreground color to bright black

Change the foreground color to bright black

Change the foreground color to bright red

Change the foreground color to bright red

Change the foreground color to bright green

Change the foreground color to bright green

Change the foreground color to bright yellow

Change the foreground color to bright yellow

Change the foreground color to bright blue

Change the foreground color to bright blue

Change the foreground color to bright magenta

Change the foreground color to bright magenta

Change the foreground color to bright purple

Change the foreground color to bright purple

Change the foreground color to bright cyan

Change the foreground color to bright cyan

Change the foreground color to bright white

Change the foreground color to bright white

Make the text bold

Make the text dim

Make the text italicized

Make the text italicized

Make the text blink

Make the text blink (but fast!)

Swap the foreground and background colors

Hide the text

Cross out the text

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more

Sets the foreground color to an RGB value.

Sets the background color to an RGB value.

Apply a runtime-determined style

Should always be Self

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

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