custom response handler for Oscar POST requests
aleksa-krolls opened this issue · 2 comments
Request
To control the API request responses and error messages logged in OpenFn for enhanced error-handling. See slack thread for the concept: https://openfn.slack.com/archives/D017F1BESP6/p1655052600211659
state
Configuration: See LP for Oscar Staging (api only user)
- You only need this configuration for the
f2-j1
job. - For the
f1-j2
job, run the relatedf1-j1
job using the Primero Demo credsPrimero Alpha Cambodia V1 - Staging API user
to generate state forj2
.
expression
Apply this change in 2 Oscar jobs that run on Primero V1:
- https://github.com/OpenFn/unicef-cambodia/blob/master/jobs/f2-j1-getOscarCases.js
- https://github.com/OpenFn/unicef-cambodia/blob/master/jobs/f1-j2-casesToOscar.js
adaptor
http v4.0.0
To Test
Feel free to run tests in the staging environment, but not 100% sure you will be able to replicate this failure on staging. If not, keep me posted and I might suggest actions to force a failure (e.g., sending the wrong credential).
See existing run as an example run log that we would want to modify.
@aleksa-krolls , check out PR #115 - I think it does the trick, though the resulting error logs are super sparse. If you're OK with only logging the error code, message, and data
key from the Oscar response, these look good.
@taylordowns2000 see my comments on the PR - I think we need to consider the custom logging requirement.