Skip to content

Handle ApiError without axios response#807

Merged
the-chris-mitchell merged 2 commits into
XeroAPI:masterfrom
miachillgood:codex/fix-api-error-missing-response
Jul 7, 2026
Merged

Handle ApiError without axios response#807
the-chris-mitchell merged 2 commits into
XeroAPI:masterfrom
miachillgood:codex/fix-api-error-missing-response

Conversation

@miachillgood

Copy link
Copy Markdown
Contributor

Summary

  • handle Axios errors that do not include a response object without throwing a secondary error
  • fall back to status code 0, empty headers, and the original error message body for network/auth setup failures
  • add ApiError regression coverage for missing-response errors and normal response-backed errors

Fixes #765.

Tests

  • npm test -- --runInBand
  • npm run build

@miachillgood miachillgood force-pushed the codex/fix-api-error-missing-response branch from 6cb3415 to 0091d5e Compare May 31, 2026 12:17
the-chris-mitchell pushed a commit to miachillgood/xero-node that referenced this pull request Jul 7, 2026
The workflow only triggered on push, so it never ran on PRs from
forks (checks showed "no checks reported" on PR XeroAPI#807). The checkout
step also pinned repository: XeroAPI/xero-node with no ref, which
would have checked out master instead of the PR head once triggered.
Also bumps node-version to 24 to match the recently updated publish
workflow.

@the-chris-mitchell the-chris-mitchell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution!

@the-chris-mitchell

the-chris-mitchell commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

@miachillgood we will target a release for early next week. Thank you!

@the-chris-mitchell the-chris-mitchell merged commit 6625a3f into XeroAPI:master Jul 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ApiError throws when response is undefined – fails to handle network/auth errors gracefully

2 participants