Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/fortifier/src/validations/email_address.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use std::{
borrow::Cow,
cell::{Ref, RefMut},
error::Error,
fmt,
rc::Rc,
sync::Arc,
};
Expand Down Expand Up @@ -197,6 +199,14 @@ pub enum EmailAddressError {
},
}

impl fmt::Display for EmailAddressError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{self:#?}")
}
}

impl Error for EmailAddressError {}

impl From<email_address::Error> for EmailAddressError {
fn from(value: email_address::Error) -> Self {
let code = EmailAddressErrorCode;
Expand Down
11 changes: 10 additions & 1 deletion packages/fortifier/src/validations/length.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use std::{
borrow::Cow,
cell::{Ref, RefMut},
collections::{BTreeMap, BTreeSet, HashMap, HashSet, LinkedList, VecDeque},
fmt::Display,
error::Error,
fmt::{self, Debug, Display},
rc::Rc,
sync::Arc,
};
Expand Down Expand Up @@ -77,6 +78,14 @@ pub enum LengthError<T> {
},
}

impl<T: Debug> fmt::Display for LengthError<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{self:#?}")
}
}

impl<T: Debug> Error for LengthError<T> {}

/// Validate a length.
pub trait ValidateLength<T>
where
Expand Down
10 changes: 10 additions & 0 deletions packages/fortifier/src/validations/phone_number.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use std::{
borrow::Cow,
cell::{Ref, RefMut},
error::Error,
fmt,
rc::Rc,
sync::Arc,
};
Expand Down Expand Up @@ -107,6 +109,14 @@ pub enum PhoneNumberError {
},
}

impl fmt::Display for PhoneNumberError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{self:#?}")
}
}

impl Error for PhoneNumberError {}

impl From<ParseError> for PhoneNumberError {
fn from(value: ParseError) -> Self {
let code = PhoneNumberErrorCode;
Expand Down
11 changes: 10 additions & 1 deletion packages/fortifier/src/validations/range.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::{
cell::{Ref, RefMut},
fmt::Display,
error::Error,
fmt::{self, Debug, Display},
rc::Rc,
sync::Arc,
};
Expand Down Expand Up @@ -88,6 +89,14 @@ pub enum RangeError<T> {
},
}

impl<T: Debug> fmt::Display for RangeError<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{self:#?}")
}
}

impl<T: Debug> Error for RangeError<T> {}

/// Validate a range.
pub trait ValidateRange<T>
where
Expand Down
10 changes: 10 additions & 0 deletions packages/fortifier/src/validations/regex.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use std::{
borrow::Cow,
cell::{Ref, RefMut},
error::Error,
fmt,
rc::Rc,
sync::{Arc, LazyLock},
};
Expand Down Expand Up @@ -67,6 +69,14 @@ impl Default for RegexError {
}
}

impl fmt::Display for RegexError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{self:#?}")
}
}

impl Error for RegexError {}

/// Validate a regular expression.
pub trait ValidateRegex {
/// Validate regular expression.
Expand Down
10 changes: 10 additions & 0 deletions packages/fortifier/src/validations/url.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use std::{
borrow::Cow,
cell::{Ref, RefMut},
error::Error,
fmt,
rc::Rc,
sync::Arc,
};
Expand Down Expand Up @@ -136,6 +138,14 @@ pub enum UrlError {
},
}

impl fmt::Display for UrlError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{self:#?}")
}
}

impl Error for UrlError {}

impl From<ParseError> for UrlError {
fn from(value: ParseError) -> Self {
let code = UrlErrorCode;
Expand Down