Skip to content

Document the v4 error-shape change and UPS's UTC timezone fallback - #178

Merged
freshlogic merged 1 commit into
mainfrom
document-v4-error-and-timezone-changes
Jul 30, 2026
Merged

Document the v4 error-shape change and UPS's UTC timezone fallback#178
freshlogic merged 1 commit into
mainfrom
document-v4-error-and-timezone-changes

Conversation

@freshlogic

Copy link
Copy Markdown
Member

Found reading main over before publishing 4.0.0. Docs only — no code changes.

1. The CHANGELOG doesn't mention the error-shape change

carriers/dhl.js and carriers/fedEx.js moved to native fetch and now reject with @stores.com/http-error. That is the most disruptive change in the release and the CHANGELOG's 4.0.0 section never says so — the only http-error mention is about the dhl-ecommerce-solutions dependency bump.

What actually changed for a consumer:

3.5.3 4.0.0
FedEx http-errors, status on err.status / err.statusCode HttpError, status on err.cause.status
DHL plain Error, message "<status> <method> <url> <body>" HttpError, message "<status> <statusText>" — replaced by the body's errors[] text when it has any

This is verified against our own code, not inferred: test/carriers/dhl.js:133-137 on main asserts err.cause.status === 401 and its comment records why it can no longer assert on the message. @stores.com/http-error@1.2.0 sets cause to the Response and overwrites message from err.json.errors[], so neither the type, the message text, nor err.status survives the upgrade.

Anyone doing if (err.status === 404) or matching error text gets silence instead of a match. That belongs in the CHANGELOG before it publishes, not after someone finds it.

Also recorded under Removed:

  • request is gone. It was required by those two files but never declared as a dependency — it resolved transitively through node-geocoder, so removing geocoding without the fetch migration would have broken the package at require time on a fresh install.
  • http-errors (replaced by @stores.com/http-error) and xml2js (which nothing required even at 3.5.3).

2. The README's timezone fallback is wrong for UPS

The README says an offsetless timestamp falls back to the local machine's timezone. That stopped being true for UPS in #172, where Mail Innovations timestamps started reading defaultTimezone and deliberately fall back to UTC instead — so a Mail Innovations scan is never interpreted in the timezone of whichever machine happens to be running. Fixed in both places the sentence appears.

The defaultTimezone option section also listed DHL and USPS only. Pitney Bowes has used it since before this release (carriers/pitneyBowes.js:83) and UPS uses it now, so both are added.

Verification

  • git diff --name-only is CHANGELOG.md and README.md. No code touched.
  • Packed main at 30dddf6 with npm pack and installed the tarball into an empty project: 15 packages, require('@stores.com/bloodhound') resolves, and guessCarrier() returns UPS/USPS/OnTrac correctly. No undeclared dependency remains after the request removal.
  • npm latest is still 3.5.3 and there is no v4.0.0 tag, so nothing here is retroactive.

🤖 Generated with Claude Code

Two gaps found reading main over before publishing 4.0.0.

The CHANGELOG never said that carriers/dhl.js and carriers/fedEx.js moved to native
fetch and now reject with @stores.com/http-error. That is the most disruptive change
in the release and the easiest to hit silently: FedEx used to reject with http-errors,
which put the status on err.status/err.statusCode, and DHL used to reject with a plain
Error whose message was "<status> <method> <url> <body>". Now both carry
err.name === 'HttpError', a "<status> <statusText>" message that the response body's
errors[] text replaces when it has any, and the status only at err.cause.status —
which is what test/carriers/dhl.js asserts today. Also records that `request` is gone
(it was required by those two files but never declared, resolving transitively through
node-geocoder) along with `http-errors` and the unused `xml2js`.

The README said an offsetless timestamp falls back to the local machine's timezone,
which stopped being true for UPS when Mail Innovations timestamps started reading
`defaultTimezone`: UPS falls back to UTC. The `defaultTimezone` option also still
listed DHL and USPS only, omitting Pitney Bowes and now UPS.

Docs only — no code changes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coveralls

coveralls commented Jul 30, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 30510346662

Coverage remained the same at 86.736%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 1738
Covered Lines: 1517
Line Coverage: 87.28%
Relevant Branches: 388
Covered Branches: 327
Branch Coverage: 84.28%
Branches in Coverage %: Yes
Coverage Strength: 17.05 hits per line

💛 - Coveralls

@freshlogic
freshlogic merged commit b795e7d into main Jul 30, 2026
2 checks passed
@freshlogic
freshlogic deleted the document-v4-error-and-timezone-changes branch July 30, 2026 03:09
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.

2 participants