Skip to main content

Errors

The gradeExam controller wraps its complete processing flow in catch (Exception). For any exception while parsing the CSV, reading or processing the image, OCR, or grading, it logs the exception server-side and returns:

HTTP 500 Internal Server Error

The controller builds this response without a response body. It does not map failures to documented 4xx statuses or return structured error details.

Some behavior is intentionally not a reliable client contract:

  • Spring may reject malformed multipart requests before the controller executes; this project does not define those framework responses.
  • extractAnswers catches its own processing exceptions, logs them, and returns its accumulated answer map. That can allow a request to receive HTTP 200 with blank or partial answer values.
  • Tesseract initialization failure makes the OCR service return the literal OCR Disabled for both configured text regions, rather than failing the request at startup.

Clients must not depend on a stable error schema, validation messages, retry safety, or an exhaustive list of status codes.