We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e708c7d + c8d4b9d commit bbbca57Copy full SHA for bbbca57
src/error.rs
@@ -69,8 +69,14 @@ impl Error {
69
}
70
71
/// Set the status code associated with this error.
72
- pub fn set_status(&mut self, status: StatusCode) {
73
- self.status = status;
+ pub fn set_status<S>(&mut self, status: S)
+ where
74
+ S: TryInto<StatusCode>,
75
+ S::Error: Debug,
76
+ {
77
+ self.status = status
78
+ .try_into()
79
+ .expect("Could not convert into a valid `StatusCode`");
80
81
82
/// Get the backtrace for this Error.
0 commit comments