Implement Comprehensive Central Error Handling Middleware for Hero API#2
Open
HermanL0201 wants to merge 6 commits into
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 Comprehensive Central Error Handling Middleware for Hero API
Description
Task
Create a central error handling middleware for the Hero API
Acceptance Criteria
Summary of Work
Overview
This pull request implements a robust, centralized error handling middleware for the Hero API, providing consistent error management, logging, and response handling across the application.
Key Features
AppErrorclass for detailed error handlingImplementation Details
1. Custom Error Class:
AppErrorstatusCodeandisOperationalproperties2. Logging Mechanism
3. Error Handler Middleware
4. Async Error Handling
asyncHandlerutility for wrapping async route handlersTesting Approach
tests/middleware/errorHandler.test.tsNotes
next(error)in route handlers for automatic error captureAppErrorfor expected error scenariosChanges Made
Tests
Signatures
Staking Key
DZwmqbbKALnQYMhTLYdYeBBKVNptDMSAKQjaASJ9btgo: 3MtkH7ztt5jdUPN6fnyohdFVz9ANMh731nHfztzMmH1mbmirQ1qXEGeycZJNtXNRgeMtCb65nY5dXcASZdQnJiCcFQEjS6zegh28Hj7FHn3XfKYRcpN3gB4LypxAhDbQYHBvW5LUaPsLyoJdoNHpJxK2Whmkoy8S1LEnWCEFAep9d3BSxVDztmRGZSVdq5imMT3cpDaZnLNZhSswTvwr8xxiH7HXMapfDdS1XasBGw1nSXyx5kQpHtFd2R5n94bwonVuswAa4LUbbfMoroENYJpLkUYxqdvh73Z2GP46j8aM9aWDxToWAGmQ4QGnkgrjjuWuVRA6T5wqdBcjQMuQkCppTy9DpoEwcptEZHRTG68u7Rgq7ygnUimGByq8csqBtz3BZcw28VSny1nseJrRaJ9yKaTi6xx1gCFE
Public Key
4E3nQUGBiknkTFLJE6Htj3KKNnHzpxhNv2Jw5cvW4s7J: VXSripkUGdE74UtQk63b9ikRZwc7xzhWu8MRLLCboKpbTtytxU6kMvKZh93u2FwRYzjmCTE1833MJaMuTunk9gMsX5tZFV9z6LZgLNLKHxS3xYoP5nfopAJgimdE8NmiHYAH4mXyTp5yWseuR5yb2jqAXqYK87nUFTrUBLCPvqBh7EBpAhdqcx3sMDfa9d5hVqUt16WM2vf2g1wknShKFT1EV1f1YGriQTqjLr9to3DxjTi6bXcnwDmoqLBfkb8nqQxVfVZDFagqxXTKgAeXWHXQNo8Xc64gYfFSGtrtVjunT78GsSxJ3L3K5S5cXvBeXoQYkjJxVFD7NoNGWSgRWYEXJs15sAP4xhur3M1wewX7Zrtx9XMus6DvD883xRsSZyoB7DySsaC6hx8dYBV2eL5je8qQtcimVzL