1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-20 04:35:38 +02:00

refactor helper error types

This commit is contained in:
Nikolay Kim
2018-01-20 21:11:46 -08:00
parent 552320bae2
commit 9180625dfd
7 changed files with 117 additions and 88 deletions

View File

@@ -6,7 +6,7 @@ use std::slice::Iter;
use std::borrow::Cow;
use smallvec::SmallVec;
use error::{ResponseError, UriSegmentError, ErrorBadRequest};
use error::{ResponseError, UriSegmentError, InternalError, ErrorBadRequest};
/// A trait to abstract the idea of creating a new instance of a type from a path parameter.
@@ -141,7 +141,7 @@ impl FromParam for PathBuf {
macro_rules! FROM_STR {
($type:ty) => {
impl FromParam for $type {
type Err = ErrorBadRequest<<$type as FromStr>::Err>;
type Err = InternalError<<$type as FromStr>::Err>;
fn from_param(val: &str) -> Result<Self, Self::Err> {
<$type as FromStr>::from_str(val).map_err(ErrorBadRequest)