aboutsummaryrefslogtreecommitdiffstats
path: root/src/errors.rs
diff options
context:
space:
mode:
authorAlec Di Vito <me@alecdivito.com>2025-02-17 04:35:26 +0000
committerAlec Di Vito <me@alecdivito.com>2025-02-17 04:35:26 +0000
commit413a63a60307bdf60229670b0f858963604d62a3 (patch)
tree45c4e203bf2d39d7cc13b96b30813be6ce44fb74 /src/errors.rs
parentMerge branch 'svenstaro:master' into upload-progress-bar (diff)
downloadminiserve-413a63a60307bdf60229670b0f858963604d62a3.tar.gz
miniserve-413a63a60307bdf60229670b0f858963604d62a3.zip
feat: implement temporary file uploads and tweak mobile design
Diffstat (limited to 'src/errors.rs')
-rw-r--r--src/errors.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/errors.rs b/src/errors.rs
index f0e22ab..24997fc 100644
--- a/src/errors.rs
+++ b/src/errors.rs
@@ -43,6 +43,10 @@ pub enum RuntimeError {
#[error("File already exists, and the overwrite_files option has not been set")]
DuplicateFileError,
+ /// Uploaded hash not correct
+ #[error("File hash that was provided did not match end result of uploaded file")]
+ UploadHashMismatchError,
+
/// Upload not allowed
#[error("Upload not allowed to this directory")]
UploadForbiddenError,
@@ -86,6 +90,7 @@ impl ResponseError for RuntimeError {
use StatusCode as S;
match self {
E::IoError(_, _) => S::INTERNAL_SERVER_ERROR,
+ E::UploadHashMismatchError => S::BAD_REQUEST,
E::MultipartError(_) => S::BAD_REQUEST,
E::DuplicateFileError => S::CONFLICT,
E::UploadForbiddenError => S::FORBIDDEN,