This commit is contained in:
maziggy
2026-02-03 13:02:36 +01:00
parent 6872d77e1d
commit 37b73b8868
3 changed files with 10 additions and 8 deletions
+4 -3
View File
@@ -672,10 +672,11 @@ async def get_printer_cover(
# Extract thumbnail from 3MF (which is a ZIP file)
try:
zf = zipfile.ZipFile(temp_path, "r")
except zipfile.BadZipFile as e:
raise HTTPException(500, f"Downloaded file is not a valid 3MF/ZIP: {e}")
except zipfile.BadZipFile:
raise HTTPException(500, "Downloaded file is not a valid 3MF/ZIP archive")
except Exception as e:
raise HTTPException(500, f"Failed to open 3MF file: {e}")
logger.error(f"Failed to open 3MF file: {e}", exc_info=True)
raise HTTPException(500, "Failed to open 3MF file. Check server logs for details.")
try:
# Try common thumbnail paths in 3MF files
+4 -3
View File
@@ -413,10 +413,10 @@ async def restore_backup(
}
except Exception as e:
logger.error(f"Restore failed: {e}")
logger.error(f"Restore failed: {e}", exc_info=True)
return JSONResponse(
status_code=500,
content={"success": False, "message": f"Restore failed: {str(e)}"},
content={"success": False, "message": "Restore failed. Check server logs for details."},
)
@@ -592,9 +592,10 @@ async def update_virtual_printer_settings(
content={"detail": str(e)},
)
except Exception as e:
logger.error(f"Failed to configure virtual printer: {e}", exc_info=True)
return JSONResponse(
status_code=500,
content={"detail": f"Failed to configure virtual printer: {e}"},
content={"detail": "Failed to configure virtual printer. Check server logs for details."},
)
return await get_virtual_printer_settings(db)
+2 -2
View File
@@ -308,8 +308,8 @@ async def clear_logs(
logger.info("Log file cleared by user")
return {"message": "Logs cleared successfully"}
except Exception as e:
logger.error(f"Error clearing log file: {e}")
raise HTTPException(status_code=500, detail=f"Failed to clear logs: {e}")
logger.error(f"Error clearing log file: {e}", exc_info=True)
raise HTTPException(status_code=500, detail="Failed to clear logs. Check server logs for details.")
return {"message": "Log file does not exist"}