OpenClinica / enketo-oc

OpenClinica's fork of the Enketo web forms monorepo
Apache License 2.0
0 stars 1 forks source link

Handling errors from OC /manifest and /formList endpoints #19

Open eprager412 opened 5 months ago

eprager412 commented 5 months ago

When we call a PDF endpoint to create a PDF of a form, we are sometimes not able to handle OC /manifest and /formList endpoints that are consumed by Enketo. In certain situations these calls might return Bad_Request, Internal Server Error, or any other type of error code to Enketo. In all cases where the call to /manifest or /formList returns an error, we want the parent call to Enketo to return a corresponding error code. Currently we have addressed the /manifest call correctly for 401 error code only https://github.com/OpenClinica/enketo-oc/issues/34,

Note below is the specific error that caused the creation of this ticket. Today we are not handling errors gracefully, for example when a Bad_Request returns, on the form load, we are seeing

"Hold on a second... in a small window Request to... failed." However, in print server, the call is returning a BLANK PDF page on each form with status code 201(success). This is not correct because the request was bad the BLANK PDF should not be generated with a success code. We expect to receive no PDF and an error code.