mirror of
https://github.com/rwf2/Rocket.git
synced 2025-02-21 16:12:18 +00:00
Change meaning of Outcome::Bad.
This commit is contained in:
parent
81fbc0625d
commit
53e5377482
@ -7,8 +7,8 @@ use std::fmt;
|
|||||||
pub enum Outcome<'h> {
|
pub enum Outcome<'h> {
|
||||||
/// Signifies a response that completed sucessfully.
|
/// Signifies a response that completed sucessfully.
|
||||||
Complete,
|
Complete,
|
||||||
/// Signifies a response that completed unsuccessfully.
|
/// Signifies a response that failed internally.
|
||||||
Bad,
|
Bad(HyperResponse<'h, HyperFresh>),
|
||||||
/// Signifies a failing response where no further processing should happen.
|
/// Signifies a failing response where no further processing should happen.
|
||||||
FailStop,
|
FailStop,
|
||||||
/// Signifies a failing response whose request should be processed further.
|
/// Signifies a failing response whose request should be processed further.
|
||||||
@ -20,7 +20,7 @@ impl<'h> Outcome<'h> {
|
|||||||
match *self {
|
match *self {
|
||||||
Outcome::Complete => "Complete",
|
Outcome::Complete => "Complete",
|
||||||
Outcome::FailStop => "FailStop",
|
Outcome::FailStop => "FailStop",
|
||||||
Outcome::Bad => "Bad",
|
Outcome::Bad(..) => "Bad",
|
||||||
Outcome::FailForward(..) => "FailForward",
|
Outcome::FailForward(..) => "FailForward",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -28,7 +28,7 @@ impl<'h> Outcome<'h> {
|
|||||||
fn as_int(&self) -> isize {
|
fn as_int(&self) -> isize {
|
||||||
match *self {
|
match *self {
|
||||||
Outcome::Complete => 0,
|
Outcome::Complete => 0,
|
||||||
Outcome::Bad => 1,
|
Outcome::Bad(..) => 1,
|
||||||
Outcome::FailStop => 2,
|
Outcome::FailStop => 2,
|
||||||
Outcome::FailForward(..) => 3,
|
Outcome::FailForward(..) => 3,
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ impl<'h> fmt::Display for Outcome<'h> {
|
|||||||
Outcome::Complete => {
|
Outcome::Complete => {
|
||||||
write!(f, "{}", Green.paint("Complete"))
|
write!(f, "{}", Green.paint("Complete"))
|
||||||
},
|
},
|
||||||
Outcome::Bad => {
|
Outcome::Bad(..) => {
|
||||||
write!(f, "{}", Yellow.paint("Bad Completion"))
|
write!(f, "{}", Yellow.paint("Bad Completion"))
|
||||||
},
|
},
|
||||||
Outcome::FailStop => {
|
Outcome::FailStop => {
|
||||||
|
@ -63,8 +63,12 @@ impl Rocket {
|
|||||||
|
|
||||||
// Get the result if we failed forward so we can try again.
|
// Get the result if we failed forward so we can try again.
|
||||||
res = match outcome {
|
res = match outcome {
|
||||||
Outcome::Complete | Outcome::FailStop | Outcome::Bad => return,
|
Outcome::Complete | Outcome::FailStop => return,
|
||||||
Outcome::FailForward(r) => r,
|
Outcome::FailForward(r) => r,
|
||||||
|
Outcome::Bad(r) => {
|
||||||
|
let reason = "Reason: bad response.";
|
||||||
|
return self.handle_internal_error(reason, &request, r)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user