diff options
author | Vojtěch Pejša <vojtechpejsa7@gmail.com> | 2019-03-28 17:32:15 +0000 |
---|---|---|
committer | Vojtěch Pejša <vojtechpejsa7@gmail.com> | 2019-04-04 08:51:00 +0000 |
commit | e2ad04f4139d0f0aceb02c43b6913d17d11087ac (patch) | |
tree | dbceff92e07d3df105cd02dffe577d4e905cd21f /src/errors.rs | |
parent | Fix file upload when used with random route. (diff) | |
download | miniserve-e2ad04f4139d0f0aceb02c43b6913d17d11087ac.tar.gz miniserve-e2ad04f4139d0f0aceb02c43b6913d17d11087ac.zip |
Better error handling for file upload.
Diffstat (limited to '')
-rw-r--r-- | src/errors.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/errors.rs b/src/errors.rs index 2aa5f58..f42cc02 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -1,6 +1,23 @@ use failure::{Backtrace, Context, Fail}; use std::fmt::{self, Debug, Display}; +/// Kinds of errors which might happen during file upload +#[derive(Debug, Fail)] +pub enum FileUploadErrorKind { + /// This error will occur when file overriding is off and file with same name already exists + #[fail(display = "File with this name already exists")] + FileExist, + /// This error will occur when server will fail to preccess http header during file upload + #[fail(display = "Failed to parse incoming request")] + ParseError, + /// This error will occur when we fail to precess multipart request + #[fail(display = "Failed to process multipart request")] + MultipartError(actix_web::error::MultipartError), + /// This error may occur when trying to write incoming file to disk + #[fail(display = "Failed to create or write to file")] + IOError(std::io::Error), +} + /// Kinds of errors which might happen during the generation of an archive #[derive(Debug, Fail)] pub enum CompressionErrorKind { |