diff --git a/index.html b/index.html
index 93df6df..babb158 100644
--- a/index.html
+++ b/index.html
@@ -102,10 +102,12 @@
"Successfully uploaded receipts"
);
} else {
- showDialog(
- "Upload Failure",
- `Failed to upload receipts: ${r.statusText}`,
- );
+ r.text().then((msg) => {
+ showDialog(
+ "Upload Failure",
+ `Failed to upload receipts: ${r.statusText}\n${msg}`,
+ );
+ });
}
form.reset();
})
diff --git a/receipts.py b/receipts.py
index ff8fd62..72a83eb 100644
--- a/receipts.py
+++ b/receipts.py
@@ -92,10 +92,14 @@ async def upload_receipts(
# notes: Annotated[list[str], fastapi.Form(alias='notes[]')],
):
if len(dates) != len(images):
+ msg = (
+ f'Number of uploaded images ({len(images)})'
+ f' does not match number of date fields ({len(dates)})'
+ )
+ log.warning('%s', msg)
raise fastapi.HTTPException(
status_code=fastapi.status.HTTP_400_BAD_REQUEST,
- detail='Number of uploaded images does not match '
- 'number of date fields',
+ detail=msg,
)
failed = False
async with Paperless() as paperless: