mirror of
https://github.com/fafhrd91/actix-web
synced 2025-09-02 17:46:38 +02:00
add resource map, it allow to check if router has resource and it allows to generate urls for named resources
This commit is contained in:
20
src/error.rs
Normal file
20
src/error.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
pub use actix_http::error::*;
|
||||
use derive_more::{Display, From};
|
||||
use url::ParseError as UrlParseError;
|
||||
|
||||
/// Errors which can occur when attempting to generate resource uri.
|
||||
#[derive(Debug, PartialEq, Display, From)]
|
||||
pub enum UrlGenerationError {
|
||||
/// Resource not found
|
||||
#[display(fmt = "Resource not found")]
|
||||
ResourceNotFound,
|
||||
/// Not all path pattern covered
|
||||
#[display(fmt = "Not all path pattern covered")]
|
||||
NotEnoughElements,
|
||||
/// URL parse error
|
||||
#[display(fmt = "{}", _0)]
|
||||
ParseError(UrlParseError),
|
||||
}
|
||||
|
||||
/// `InternalServerError` for `UrlGeneratorError`
|
||||
impl ResponseError for UrlGenerationError {}
|
Reference in New Issue
Block a user