1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-12-21 23:56:35 +00:00

move ReadlinesError to error module

This commit is contained in:
Dursun Akkurt 2018-06-13 22:59:36 +03:00
parent ad9aacf521
commit 1bee528018
2 changed files with 27 additions and 26 deletions

View file

@ -590,6 +590,32 @@ impl From<JsonError> for JsonPayloadError {
}
}
/// Error type returned when reading body as lines.
pub enum ReadlinesError {
EncodingError,
PayloadError(PayloadError),
LimitOverflow,
ContentTypeError(ContentTypeError),
}
impl From<PayloadError> for ReadlinesError {
fn from(err: PayloadError) -> Self {
ReadlinesError::PayloadError(err)
}
}
impl From<Error> for ReadlinesError {
fn from(_: Error) -> Self {
ReadlinesError::EncodingError
}
}
impl From<ContentTypeError> for ReadlinesError {
fn from(err: ContentTypeError) -> Self {
ReadlinesError::ContentTypeError(err)
}
}
/// Errors which can occur when attempting to interpret a segment string as a
/// valid path segment.
#[derive(Fail, Debug, PartialEq)]

View file

@ -13,7 +13,7 @@ use std::str;
use error::{
ContentTypeError, HttpRangeError, ParseError, PayloadError, UrlencodedError,
Error, ErrorBadRequest
Error, ErrorBadRequest, ReadlinesError
};
use header::Header;
use json::JsonBody;
@ -394,31 +394,6 @@ where
}
}
pub enum ReadlinesError {
EncodingError,
PayloadError(PayloadError),
LimitOverflow,
ContentTypeError(ContentTypeError),
}
impl From<PayloadError> for ReadlinesError {
fn from(err: PayloadError) -> Self {
ReadlinesError::PayloadError(err)
}
}
impl From<Error> for ReadlinesError {
fn from(_: Error) -> Self {
ReadlinesError::EncodingError
}
}
impl From<ContentTypeError> for ReadlinesError {
fn from(err: ContentTypeError) -> Self {
ReadlinesError::ContentTypeError(err)
}
}
/// Future that resolves to a complete http message body.
pub struct MessageBody<T> {
limit: usize,