Skip to content

Commit b3806e6

Browse files
committed
Fix more small things
1 parent 10b9faa commit b3806e6

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

core/lib/src/data/data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl<'r> Data<'r> {
114114
/// use rocket::data::{Data, FromData, Outcome};
115115
/// use rocket::http::Status;
116116
/// # struct MyType;
117-
/// # #[derive(rocket::TypedError)]
117+
/// # #[derive(rocket::TypedError, Debug)]
118118
/// # struct MyError;
119119
///
120120
/// #[rocket::async_trait]

core/lib/src/data/from_data.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::fmt;
2+
13
use crate::catcher::TypedError;
24
use crate::http::RawStr;
35
use crate::request::{Request, local_cache};
@@ -182,7 +184,7 @@ pub type Outcome<'r, T, E = <T as FromData<'r>>::Error>
182184
/// use rocket::request::Request;
183185
/// use rocket::data::{self, Data, FromData};
184186
/// # struct MyType;
185-
/// # #[derive(rocket::TypedError)]
187+
/// # #[derive(rocket::TypedError, Debug)]
186188
/// # struct MyError;
187189
///
188190
/// #[rocket::async_trait]
@@ -312,7 +314,7 @@ pub type Outcome<'r, T, E = <T as FromData<'r>>::Error>
312314
#[crate::async_trait]
313315
pub trait FromData<'r>: Sized {
314316
/// The associated error to be returned when the guard fails.
315-
type Error: TypedError<'r> + 'r;
317+
type Error: TypedError<'r> + fmt::Debug + 'r;
316318

317319
/// Asynchronously validates, parses, and converts an instance of `Self`
318320
/// from the incoming request body data.

core/lib/src/request/from_param.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ use crate::http::{uri::{Segments, error::PathError, fmt::Path}, Status};
160160
/// use rocket::TypedError;
161161
/// # #[allow(dead_code)]
162162
/// # struct MyParam<'r> { key: &'r str, value: usize }
163-
/// #[derive(TypedError)]
163+
/// #[derive(TypedError, Debug)]
164164
/// struct MyParamError<'a>(&'a str);
165165
///
166166
/// impl<'r> FromParam<'r> for MyParam<'r> {
@@ -192,7 +192,7 @@ use crate::http::{uri::{Segments, error::PathError, fmt::Path}, Status};
192192
/// # #[macro_use] extern crate rocket;
193193
/// # use rocket::request::FromParam;
194194
/// # use rocket::TypedError;
195-
/// # #[derive(TypedError)]
195+
/// # #[derive(TypedError, Debug)]
196196
/// # struct MyParamError<'a>(&'a str);
197197
/// # #[allow(dead_code)]
198198
/// # struct MyParam<'r> { key: &'r str, value: usize }
@@ -215,7 +215,7 @@ use crate::http::{uri::{Segments, error::PathError, fmt::Path}, Status};
215215
/// ```
216216
pub trait FromParam<'a>: Sized {
217217
/// The associated error to be returned if parsing/validation fails.
218-
type Error: TypedError<'a>;
218+
type Error: TypedError<'a> + fmt::Debug + 'a;
219219

220220
/// Parses and validates an instance of `Self` from a path parameter string
221221
/// or returns an `Error` if parsing or validation fails.
@@ -397,7 +397,7 @@ impl<'a, T: FromParam<'a>> FromParam<'a> for Option<T> {
397397
/// the `Utf8Error`.
398398
pub trait FromSegments<'r>: Sized {
399399
/// The associated error to be returned when parsing fails.
400-
type Error: TypedError<'r>;
400+
type Error: TypedError<'r> + fmt::Debug + 'r;
401401

402402
/// Parses an instance of `Self` from many dynamic path parameter strings or
403403
/// returns an `Error` if one cannot be parsed.

core/lib/src/request/from_request.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::convert::Infallible;
2+
use std::fmt;
23
use std::net::{IpAddr, SocketAddr};
34

45
use crate::catcher::TypedError;
@@ -36,7 +37,7 @@ pub type Outcome<S, E> = outcome::Outcome<S, E, E>;
3637
/// use rocket::request::{self, Request, FromRequest};
3738
/// # struct MyType;
3839
/// # use rocket::TypedError;
39-
/// # #[derive(TypedError)]
40+
/// # #[derive(TypedError, Debug)]
4041
/// # struct MyError;
4142
///
4243
/// #[rocket::async_trait]
@@ -408,7 +409,7 @@ pub type Outcome<S, E> = outcome::Outcome<S, E, E>;
408409
#[crate::async_trait]
409410
pub trait FromRequest<'r>: Sized {
410411
/// The associated error to be returned if derivation fails.
411-
type Error: TypedError<'r> + 'r;
412+
type Error: TypedError<'r> + fmt::Debug + 'r;
412413

413414
/// Derives an instance of `Self` from the incoming request metadata.
414415
///

docs/guide/12-pastebin.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ use rocket::tokio::fs::File;
367367
# pub fn new(size: usize) -> PasteId<'static> { todo!() }
368368
# pub fn file_path(&self) -> PathBuf { todo!() }
369369
# }
370-
# #[derive(rocket::TypedError)]
370+
# #[derive(Debug, rocket::TypedError)]
371371
# pub struct InvalidPasteId;
372372
# impl<'a> FromParam<'a> for PasteId<'a> {
373373
# type Error = InvalidPasteId;
@@ -446,7 +446,7 @@ pub struct PasteId<'a>(Cow<'a, str>);
446446
# pub fn file_path(&self) -> PathBuf { todo!() }
447447
# }
448448
#
449-
# #[derive(rocket::TypedError)]
449+
# #[derive(Debug, rocket::TypedError)]
450450
# pub struct InvalidPasteId;
451451
# impl<'a> FromParam<'a> for PasteId<'a> {
452452
# type Error = InvalidPasteId;

0 commit comments

Comments
 (0)