Conversation
Refactor for log errors and API handling
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cfffbc68ad
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if ($xml === false) { | ||
| echo "<div class='alert alert-danger mt-3 text-center'>Item record does not exist</div>"; |
There was a problem hiding this comment.
Distinguish Alma API failures from missing item records
This branch reports "Item record does not exist" whenever no candidate lookup succeeds, but the loop also reaches that path on transport/API failures (timeouts, DNS, 5xx), because almaGetXml() errors are discarded. In those cases users get a false “missing item” result for valid barcodes and may take incorrect operational actions; please surface the last HTTP/cURL error (or at least a separate API-failure message) before falling back to not-found.
Useful? React with 👍 / 👎.
| if ($jsonLine !== false) { | ||
| file_put_contents($file, $jsonLine . "\n", FILE_APPEND | LOCK_EX); |
There was a problem hiding this comment.
Fail loudly when NDJSON audit writes do not persist
The refactor now ignores file_put_contents() failures (and only guards JSON encoding), so batch updates can be shown as successful while audit rows are silently dropped from refile.ndjson. This regresses traceability compared to the prior behavior that aborted on write errors; at minimum, check the write return value and report an error so operators know logging failed.
Useful? React with 👍 / 👎.
Refactor for log errors and API handling