Implement Centralized Error Response Utility for CDN File Retrieval Service#7
Open
Dewin2309 wants to merge 5 commits intoparker110-crypto:817de48b-c2a1-40c7-b6bb-b7051fbe31b5from
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement Centralized Error Response Utility for CDN File Retrieval Service
Description
Task
Develop a consistent error response mechanism for the CDN file retrieval service
Acceptance Criteria
Summary of Work
This pull request introduces a robust, centralized error response mechanism for the CDN file retrieval service, providing a standardized approach to error handling and reporting.
Key Changes
src/utils/error-response.tsErrorResponseinterface for consistent error structureErrorTypeenum to categorize different error scenarioscreateErrorResponse()function to generate standardized error responseshandleErrorResponse()function for centralized error loggingImplementation Details
ErrorResponse Interface
status(HTTP status code),code(error identifier),message(user-friendly description), and optionaldetailsErrorType Enum
Covers key error scenarios:
NOT_FOUND: 404 errors for missing filesFORBIDDEN: 403 errors for unauthorized accessINTERNAL_ERROR: 500 errors for server-side issuesINVALID_REQUEST: 400 errors for malformed requestsError Creation and Handling
createErrorResponse()generates context-specific error responseshandleErrorResponse()prepares for future logging integrationTesting Approach
Notes
console.error()for loggingChanges Made
Tests
Signatures
Staking Key
4eJHgFX9XuS4QYt3jJ1KpqAFkWA1WNqdNaJNeccptn9c: QQe558kkiAiJ74ABe2g16wuaq2dzABYMaGDQjbdHZzPC6sAHSaRmedFJbMBAt1n8pMk1GCqEbP3Seqg6ABvyhqZB5B5GCZLLeY2bTfYL2HX3RxwRyaUt8i53vUQvUNxhPw9DjNcJyG2vmXE7mAmPLrWuZvtpmmLCACkJUxp2CNuiXScGBurbhreiYDJTwTf1gkVZEgmtTq8ne1PYiRyqmirPK7mNokCTyWiXZC9kWvVVeUUXYP3ik1QNjMR65caJknPPUVvjDYwrizhS4L3TGCgjFHot1bPT9HZ7ZnJXFF7oyiWgNVUwaZumYN7GwdXxxvqNxn5Ap1ugnuBqBnC5r2ywdikELVuiggo9M5D9TTN9jhZmiqANEoKCS8e9rAUZeLUc92hF9UvVEk5KUr1wfXzusyXssVmyQ8
Public Key
AR4eSn41nSiWG1NPL51RfnatiKQa6fSFGwPDgEZc2nSB: SKnBnTugroCqPatmWiwmmpEDtGhvouh4GfhFJofLe53eghZZpmjLUFdZaQ7T1Ne9Ua3CiF4H9YqmSvRkcFhism39odJ5gJEhXKhNC9mWS4xok3s4dfEf69bJbqgZMjfQ8Moqgez4sipd9omubVcJYpJmrS8kGwmhU5XtZWvmb3kTvwPCe83jyYkZptXHs5kaxoA3oNyGHsieZTZcndBZD4TJHLkdRyVVPaap4NTzBX8VSJkUy7fazBRPpknT288BpM6tXuRsAUMcTQuRS9yeFxGDL2NttWEzYxznpo4juQAKat3tJX4RJXWzUNQ97GB3MkG2jhmf26A7ZchzsSjxkSZiCarALXBEeC3HzrZX7bNPDTvdyrJ82RV3NsnKmb6ncdNGUMP3ie5JJFrZ2Q6EKL4W862QsGyfc8