Wrap baza network failures#31
Conversation
GHX5T-SOL
left a comment
There was a problem hiding this comment.
Reviewed and verified.
The patch wraps only fetch() rejections in baza(), keeps the existing HTTP status handling unchanged, and preserves the original failure on cause. The regression stubs globalThis.fetch to reject and asserts the wrapped message plus cause, so it covers the issue without relying on live Zerocracy responses.
Validation I ran locally on head eb40343:
npm ci-> completed; npm reported existing audit findings, and this PR does not change dependencies.npm exec jest -- --config jest.config.ts --no-color --ci test/baza.test.ts -t 'wraps network failures' --coverage=false-> 1 passed, 4 skipped.npm exec eslint -- src/baza.ts test/baza.test.ts --config eslint.config.mjs-> passed.npm exec tsc -- --noEmit-> passed.git diff --check origin/master...HEAD-> passed.git diff origin/master...HEAD | gitleaks stdin --no-banner --redact --exit-code 1-> no leaks found.
Limitation: running all of test/baza.test.ts locally is red on the live endpoint cases with the placeholder token (HTTP error 303/400 responses), so I used the mocked regression for this PR-specific path.
|
@AjTheSpidey Hi! Just a quick note about branch naming: according to our guidelines, it's best to name branches using the ticket number you're working on. For your branch " |
|
@GHX5T-SOL Hey! Nice work on the review! 🎯 You've earned +10 points for this one: +18 as a basis, but -8 since no comments were posted (our policy encourages reviewers to share feedback to help improve code quality). Your running score is +188 - keep it up! Don't forget to check your Zerocracy account too. |
|
Please fix the merge conflicts so this pull request can be merged. |
…work-errors # Conflicts: # src/baza.ts # test/baza.test.ts
Fixes #28.
baza()now wraps network-levelfetch()failures in a regularErrorwith the request method and URL in the message. It still keeps the original failure attached ascause, so callers get a readable error without losing the lower-level reason.I added a mocked fetch test for the network-failure path.
Tested:
I did not claim the full Jest suite as passing locally. The existing live
bazatests hit Zerocracy with the placeholder token and currently fail on the server response before this change is involved.