mirror of https://github.com/fafhrd91/actix-web
move result alias to web
This commit is contained in:
parent
947caa3599
commit
bc322c95a6
|
@ -17,10 +17,12 @@
|
|||
### Removed
|
||||
* Stop re-exporting `http` crate's `HeaderMap` types in addition to ours. [#2171]
|
||||
* Down-casting for `MessageBody` types. [#2183]
|
||||
* `error::Result` alias. [#????]
|
||||
|
||||
[#2171]: https://github.com/actix/actix-web/pull/2171
|
||||
[#2183]: https://github.com/actix/actix-web/pull/2183
|
||||
[#2196]: https://github.com/actix/actix-web/pull/2196
|
||||
[#????]: https://github.com/actix/actix-web/pull/????
|
||||
|
||||
|
||||
## 3.0.0-beta.6 - 2021-04-17
|
||||
|
|
|
@ -18,12 +18,6 @@ use crate::{body::Body, helpers::Writer, Response, ResponseBuilder};
|
|||
|
||||
pub use http::Error as HttpError;
|
||||
|
||||
/// A specialized [`std::result::Result`] for Actix Web operations.
|
||||
///
|
||||
/// This typedef is generally used to avoid writing out `actix_http::error::Error` directly and is
|
||||
/// otherwise a direct mapping to `Result`.
|
||||
pub type Result<T, E = Error> = std::result::Result<T, E>;
|
||||
|
||||
/// General purpose actix web error.
|
||||
///
|
||||
/// An actix web error is used to carry errors from `std::error`
|
||||
|
|
|
@ -104,7 +104,7 @@ impl Display for Charset {
|
|||
impl FromStr for Charset {
|
||||
type Err = crate::Error;
|
||||
|
||||
fn from_str(s: &str) -> crate::Result<Charset> {
|
||||
fn from_str(s: &str) -> Result<Charset, crate::Error> {
|
||||
Ok(match s.to_ascii_uppercase().as_ref() {
|
||||
"US-ASCII" => Us_Ascii,
|
||||
"ISO-8859-1" => Iso_8859_1,
|
||||
|
|
|
@ -54,7 +54,7 @@ pub mod ws;
|
|||
|
||||
pub use self::builder::HttpServiceBuilder;
|
||||
pub use self::config::{KeepAlive, ServiceConfig};
|
||||
pub use self::error::{Error, ResponseError, Result};
|
||||
pub use self::error::{Error, ResponseError};
|
||||
pub use self::extensions::Extensions;
|
||||
pub use self::header::ContentEncoding;
|
||||
pub use self::http_message::HttpMessage;
|
||||
|
|
|
@ -9,6 +9,11 @@ use url::ParseError as UrlParseError;
|
|||
|
||||
use crate::http::StatusCode;
|
||||
|
||||
/// A convenience [`Result`](std::result::Result) for Actix Web operations.
|
||||
///
|
||||
/// This type alias is generally used to avoid writing out `actix_http::Error` directly.
|
||||
pub type Result<T, E = actix_http::Error> = std::result::Result<T, E>;
|
||||
|
||||
/// Errors which can occur when attempting to generate resource uri.
|
||||
#[derive(Debug, PartialEq, Display, Error, From)]
|
||||
#[non_exhaustive]
|
||||
|
@ -26,7 +31,6 @@ pub enum UrlGenerationError {
|
|||
ParseError(UrlParseError),
|
||||
}
|
||||
|
||||
/// `InternalServerError` for `UrlGeneratorError`
|
||||
impl ResponseError for UrlGenerationError {}
|
||||
|
||||
/// A set of errors that can occur during parsing urlencoded payloads
|
||||
|
@ -70,7 +74,6 @@ pub enum UrlencodedError {
|
|||
Payload(PayloadError),
|
||||
}
|
||||
|
||||
/// Return `BadRequest` for `UrlencodedError`
|
||||
impl ResponseError for UrlencodedError {
|
||||
fn status_code(&self) -> StatusCode {
|
||||
match self {
|
||||
|
@ -149,7 +152,6 @@ pub enum QueryPayloadError {
|
|||
Deserialize(serde::de::value::Error),
|
||||
}
|
||||
|
||||
/// Return `BadRequest` for `QueryPayloadError`
|
||||
impl ResponseError for QueryPayloadError {
|
||||
fn status_code(&self) -> StatusCode {
|
||||
StatusCode::BAD_REQUEST
|
||||
|
@ -177,7 +179,6 @@ pub enum ReadlinesError {
|
|||
ContentTypeError(ContentTypeError),
|
||||
}
|
||||
|
||||
/// Return `BadRequest` for `ReadlinesError`
|
||||
impl ResponseError for ReadlinesError {
|
||||
fn status_code(&self) -> StatusCode {
|
||||
match *self {
|
||||
|
|
|
@ -97,7 +97,7 @@ pub(crate) mod types;
|
|||
pub mod web;
|
||||
|
||||
pub use actix_http::Response as BaseHttpResponse;
|
||||
pub use actix_http::{body, Error, HttpMessage, ResponseError, Result};
|
||||
pub use actix_http::{body, Error, HttpMessage, ResponseError};
|
||||
#[doc(inline)]
|
||||
pub use actix_rt as rt;
|
||||
pub use actix_web_codegen::*;
|
||||
|
@ -105,6 +105,7 @@ pub use actix_web_codegen::*;
|
|||
pub use cookie;
|
||||
|
||||
pub use crate::app::App;
|
||||
pub use crate::error::Result;
|
||||
pub use crate::extract::FromRequest;
|
||||
pub use crate::request::HttpRequest;
|
||||
pub use crate::resource::Resource;
|
||||
|
|
Loading…
Reference in New Issue