Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ To handle 500 errors effectively:
- Log the error details for debugging purposes.
- Return a user-friendly error message to the client without exposing sensitive information.

#### Enhanced Logging
Consider using a logging library to manage logs more effectively. This can help in categorizing logs, setting log levels, and storing logs in a centralized location.

Example:
```javascript
app.get('/api/resource', (req, res) => {
try {
// Code that may throw an error
} catch (error) {
console.error(error);
logger.error(error); // Using a logging library
res.status(500).send('Internal Server Error');
}
});
```
```