Update Error raising in uploads and image processing

This commit is contained in:
n07070
2026-06-04 19:26:21 +02:00
parent b5e3c8cd01
commit 3b5b19ff19
2 changed files with 63 additions and 44 deletions

View File

@@ -44,7 +44,7 @@ class Web:
file_uploaded = self.upload_file(image)
except Exception as e:
self.app.logger.error(e)
raise RuntimeError("Could not upload file") from e
raise RuntimeError("Could not upload file : " + str(e)) from e
if file_uploaded:
self.app.logger.debug("File has been uploaded, printing...")
@@ -100,7 +100,7 @@ class Web:
image.save(os.path.join(self.app.config["UPLOAD_FOLDER"], filename))
except OSError as e:
self.app.logger.error("Could not save file %s", e)
return False
raise RuntimeError("An OS error occured while uploading this file : " + str(e)) from e
self.app.logger.debug(
"File saved to "
@@ -111,7 +111,7 @@ class Web:
self.app.logger.error(
"Could not save file because the filename is forbidden"
)
return False
raise RuntimeError("This file type is forbidden.")
def get_queue_state(self):
"""Return current queue state"""