Skip to content

Conversation

@Jipperism
Copy link
Collaborator

  • Refactored multiple API routes to utilize the new error handling utilities, ensuring consistent error responses and improved maintainability.
  • Improved error handling in the Claim component to log errors more effectively and provide clearer feedback on proof generation failures.
  • Updated axios fetcher to throw detailed errors based on API response codes.
  • Introduced a new error handling utility in the API layer to standardize error responses across various endpoints, including bad requests and internal errors.

@Jipperism Jipperism requested a review from ECWireless as a code owner January 10, 2026 10:16
@vercel
Copy link

vercel bot commented Jan 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
explorer-arbitrum-one Ready Ready Preview, Comment Jan 12, 2026 10:45am

@Jipperism Jipperism self-assigned this Jan 10, 2026
@Jipperism Jipperism moved this from Backlog to In Review in Explorer Revamp Jan 10, 2026
@Jipperism
Copy link
Collaborator Author

Closes #338

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request refactors error handling across multiple API routes to standardize error responses and improve maintainability. It introduces a new centralized error handling utility layer and updates axios fetcher to throw structured errors based on API response codes.

Changes:

  • Introduced new error handling utilities (lib/api/errors.ts and lib/api/types/api-error.ts) that standardize error responses with consistent structure (error message, error code, optional details)
  • Updated 15+ API endpoints to use the new error handling utilities, replacing inconsistent error responses with standardized ones
  • Enhanced client-side error handling in axios fetcher and frontend components to parse and propagate structured error messages

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 15 comments.

Show a summary per file
File Description
lib/api/errors.ts New centralized error handling utilities with functions for common HTTP error responses (400, 404, 405, 500, 502)
lib/api/types/api-error.ts Type definitions for standardized API error structure with error codes
lib/axios.ts Enhanced axios fetcher to extract and throw structured errors from API responses
utils/ipfs.ts Added error handling for IPFS upload failures with structured error messages
components/Claim/index.tsx Improved error handling for proof generation with proper error logging
pages/api/usage.tsx Refactored to use new error utilities, removed nested try-catch block
pages/api/upload-ipfs.tsx Updated to use new error handling utilities
pages/api/totalTokenSupply.tsx Refactored with method validation and consistent error handling
pages/api/treasury/votes/[address]/registered.tsx Updated to use new error utilities for validation and internal errors
pages/api/treasury/votes/[address]/index.tsx Updated to use new error utilities for validation and internal errors
pages/api/treasury/proposal/[proposalId]/votes/[address].tsx Updated to use new error utilities for validation and internal errors
pages/api/treasury/proposal/[proposalId]/state.tsx Updated to use new error utilities for validation and internal errors
pages/api/score/index.tsx Updated to use new error utilities
pages/api/score/[address].tsx Updated to use new error utilities with specific external API error handling
pages/api/regions/index.ts Updated to use new error utilities
pages/api/pipelines/index.tsx Updated to use new error utilities
pages/api/pending-stake/[address].tsx Updated to use new error utilities
pages/api/l1-delegator/[address].tsx Updated to use new error utilities
pages/api/generateProof.tsx Added input validation and consistent error handling
pages/api/ens-data/index.tsx Updated to use new error utilities
pages/api/ens-data/image/[name].tsx Updated to use new error utilities including notFound handling
pages/api/ens-data/[address].tsx Updated to use new error utilities
pages/api/current-round.tsx Updated to use new error utilities
pages/api/contracts.tsx Updated to use new error utilities
pages/api/changefeed.tsx Refactored with method validation and consistent error handling
pages/api/account-balance/[address].tsx Updated to use new error utilities

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@ECWireless ECWireless left a comment

Choose a reason for hiding this comment

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

Looks great! Though, copilot caught some super small stuff that I agree with

@github-project-automation github-project-automation bot moved this from In Review to Todo in Explorer Revamp Jan 11, 2026
- Refactored multiple API routes to utilize the new error handling utilities, ensuring consistent error responses and improved maintainability.
- Improved error handling in the Claim component to log errors more effectively and provide clearer feedback on proof generation failures.
- Updated axios fetcher to throw detailed errors based on API response codes.
- Introduced a new error handling utility in the API layer to standardize error responses across various endpoints, including bad requests and internal errors.
- Updated error handling in multiple API routes to throw detailed errors instead of returning bad requests, enhancing clarity in error reporting.
- Enhanced the axios fetcher to provide more informative error messages based on API response codes.
- Standardized error responses across various endpoints for better maintainability and consistency.
@Jipperism Jipperism force-pushed the bugfix/inconsistent-api-error-handling branch from 648a973 to f002b7d Compare January 12, 2026 10:43
@Jipperism
Copy link
Collaborator Author

@ECWireless all PR feedback implemented.

@github-project-automation github-project-automation bot moved this from In Review to Todo in Explorer Revamp Jan 12, 2026
@ECWireless ECWireless merged commit 17c6fac into main Jan 12, 2026
6 checks passed
@ECWireless ECWireless deleted the bugfix/inconsistent-api-error-handling branch January 12, 2026 15:42
@github-project-automation github-project-automation bot moved this from Todo to Done in Explorer Revamp Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants