Commit Graph

11 Commits

Author SHA1 Message Date
Reilly Tucker Siemens 5e30262378 Add tests for errors example. 2017-01-06 00:43:20 -06:00
Sergio Benitez 650d079b58 Make the `uri` parameter in Request private. 2016-10-06 00:08:00 -07:00
Sergio Benitez d4f9525b22 Allow error handlers to take 0, 1, or 2 parameters.
fixes #13
2016-10-04 15:05:25 -07:00
Sergio Benitez 4b6c72e33f Use move builder pattern to launch Rocket apps. 2016-10-03 19:48:33 -07:00
Sergio Benitez 7b1dc5a1a4 Remove Rocket::new(). Use 'ignite' everywhere. 2016-10-03 19:37:49 -07:00
Sergio Benitez 46f73ed57c Renamed macros to codegen. 2016-09-08 20:38:58 -07:00
Sergio Benitez a42d7f8668 Complete rewrite of macro parsing and item generation. 2016-09-04 01:05:17 -07:00
Sergio Benitez 90d8621adf Major overhual: Request, ErrorHandler, ContentType. 2016-08-26 01:55:11 -07:00
Sergio Benitez 26b7b814f4 Progress on errors. Started Todo example.
The error function now takes in a "RoutingError" structure. The idea is that the
structure includes all of the information necessary for a user to processor the
error as they wish. This interface is very incomplete and may change. At a
minimum, the error structure should include:

  1) The request that failed.
  2) Why the request failed.
  3) The chain of attempted route matches, if any.
  4) Something else?
2016-07-15 21:09:08 -07:00
Sergio Benitez 1ef7a15bab Working error handling! Not quite there yet though.
A few important things needs to get this to be 'right':
  1a. Have a way to return a response with a status code.
  1b. Use that mechanism in the default catchers.
  2. Automatically fill in that code from the #[error] handler.
  3. Have a way for a responder to say if responding succeeded.
  4. Try next highest ranking route if responding with one handler fails.
2016-04-06 13:50:02 -07:00
Sergio Benitez dc5ef6a421 Progress on error handling. Calling them 'catchers' for now.
Added `error` decorator and `errors` macro.

The current idea is that you can have "catchers" for all valid errors code (in
range [400, 500). At the moment, catchers are just request handlers, and the
decorator expected an empty function signature for the error handler. Obviously,
this is pretty useless. Not sure on what the API should be here. But, progress.

Oh, one more thing: who should handle forwarding a request to a catcher?
Probably not the router. So, the main Rocket should?
2016-04-06 03:26:43 -07:00