aboutsummaryrefslogtreecommitdiffstats
path: root/src/errors.rs
diff options
context:
space:
mode:
authorboasting-squirrel <boasting.squirrel@gmail.com>2019-04-06 14:39:12 +0000
committerboasting-squirrel <boasting.squirrel@gmail.com>2019-04-06 14:39:12 +0000
commit134c7397d4a8686fd091119c7ab2bcc06f0247e8 (patch)
tree8ef74dcb80bd93760af8edb3e2f534c6b6856331 /src/errors.rs
parentUse serde lowercase for SortingMethods enum (diff)
parentMerge pull request #58 from vojta7/file_uploading (diff)
downloadminiserve-134c7397d4a8686fd091119c7ab2bcc06f0247e8.tar.gz
miniserve-134c7397d4a8686fd091119c7ab2bcc06f0247e8.zip
Merged upload + adapted it to the new design
Diffstat (limited to 'src/errors.rs')
-rw-r--r--src/errors.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/errors.rs b/src/errors.rs
index 2aa5f58..21d9e07 100644
--- a/src/errors.rs
+++ b/src/errors.rs
@@ -1,6 +1,26 @@
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 a file with same name already exists
+ #[fail(display = "File with this name already exists")]
+ FileExist,
+ /// This error will occur when the server fails to process the HTTP header during file upload
+ #[fail(display = "Failed to parse incoming request")]
+ ParseError,
+ /// This error will occur when we fail to process the multipart request
+ #[fail(display = "Failed to process multipart request")]
+ MultipartError(actix_web::error::MultipartError),
+ /// This error may occur when trying to write the incoming file to disk
+ #[fail(display = "Failed to create or write to file")]
+ IOError(std::io::Error),
+ /// This error will occur when we he have insuffictent permissions to create new file
+ #[fail(display = "Insufficient permissions to create file")]
+ InsufficientPermissions,
+}
+
/// Kinds of errors which might happen during the generation of an archive
#[derive(Debug, Fail)]
pub enum CompressionErrorKind {