Improved

Clear errors for empty and invalid PDF uploads

Uploading an empty file, or a file named .pdf that isn't a valid PDF, used to return a 500 server error. Upload an original now returns a 400 with an error code you can act on.

{
  "error_code": "empty_file",
  "message": "The uploaded file is empty. Please upload a valid file."
}
{
  "error_code": "invalid_file",
  "message": "The uploaded file is not a valid PDF document."
}

Don't retry these uploads. The same file fails the same way every time, so ask your user for a different file.