|
1 | 1 | use futures::future::{FutureExt, Future};
|
2 | 2 |
|
3 |
| -use crate::catcher::{default_error_type, ErasedError}; |
| 3 | +use crate::catcher::Error; |
4 | 4 | use crate::trace::Trace;
|
5 | 5 | use crate::util::Formatter;
|
6 | 6 | use crate::data::IoHandler;
|
@@ -202,7 +202,7 @@ impl Rocket<Orbit> {
|
202 | 202 | // Go through all matching routes until we fail or succeed or run out of
|
203 | 203 | // routes to try, in which case we forward with the last status.
|
204 | 204 | let mut status = Status::NotFound;
|
205 |
| - let mut error = default_error_type(); |
| 205 | + let mut error = None; |
206 | 206 | for route in self.router.route(request) {
|
207 | 207 | // Retrieve and set the requests parameters.
|
208 | 208 | route.trace_info();
|
@@ -236,7 +236,7 @@ impl Rocket<Orbit> {
|
236 | 236 | &'s self,
|
237 | 237 | mut status: Status,
|
238 | 238 | req: &'r Request<'s>,
|
239 |
| - mut error: ErasedError<'r>, |
| 239 | + mut error: Option<Box<dyn Error<'r>>>, |
240 | 240 | ) -> Response<'r> {
|
241 | 241 | // We may wish to relax this in the future.
|
242 | 242 | req.cookies().reset_delta();
|
@@ -273,17 +273,17 @@ impl Rocket<Orbit> {
|
273 | 273 | async fn invoke_catcher<'s, 'r: 's>(
|
274 | 274 | &'s self,
|
275 | 275 | status: Status,
|
276 |
| - error: ErasedError<'r>, |
| 276 | + error: Option<Box<dyn Error<'r>>>, |
277 | 277 | req: &'r Request<'s>
|
278 |
| - ) -> Result<Response<'r>, (Option<Status>, ErasedError<'r>)> { |
| 278 | + ) -> Result<Response<'r>, (Option<Status>, Option<Box<dyn Error<'r>>>)> { |
279 | 279 | if let Some(catcher) = self.router.catch(status, req) {
|
280 | 280 | catcher.trace_info();
|
281 | 281 | catch_handle(
|
282 | 282 | catcher.name.as_deref(),
|
283 | 283 | || catcher.handler.handle(status, req, error)
|
284 | 284 | ).await
|
285 | 285 | .map(|result| result.map_err(|(s, e)| (Some(s), e)))
|
286 |
| - .unwrap_or_else(|| Err((None, default_error_type()))) |
| 286 | + .unwrap_or_else(|| Err((None, None))) |
287 | 287 | } else {
|
288 | 288 | info!(name: "catcher", name = "rocket::default", "uri.base" = "/", code = status.code,
|
289 | 289 | "no registered catcher: using Rocket default");
|
|
0 commit comments