Skip to content

refactor: unify contract-error normalization into errors.ts#546

Open
Riel101 wants to merge 1 commit into
Commitlabs-Org:masterfrom
Riel101:chore/consolidate-contract-error-normalization
Open

refactor: unify contract-error normalization into errors.ts#546
Riel101 wants to merge 1 commit into
Commitlabs-Org:masterfrom
Riel101:chore/consolidate-contract-error-normalization

Conversation

@Riel101
Copy link
Copy Markdown

@Riel101 Riel101 commented May 29, 2026

Close #491

PR Description

Summary

Unify contract and blockchain error normalization into a single backend error layer so on-chain failures are classified consistently and retryability is preserved.

What changed

  • Centralized blockchain error classification inside errors.ts
  • Removed duplicate local contract normalization logic from contracts.ts
  • Updated normalizeBackendError() so RPC timeout, rate-limit, and other contract errors are classified consistently and existing BackendError retryable behavior is preserved
  • Added focused unit tests in errors.test.ts covering timeout, rate-limit, and fallback classification behavior
  • Updated backend-error-codes.md to document the unified error normalization path

Validation

  • Ran pnpm --dir /workspaces/Commitlabs-Frontend exec vitest run src/lib/backend/errors.test.ts
  • Result: 32 passed

@vercel
Copy link
Copy Markdown

vercel Bot commented May 29, 2026

@Riel101 is attempting to deploy a commit to the 1nonly's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

Backend - Refactor duplicated contract-error normalization between contracts.ts and errors.ts

1 participant