Skip to content

Commit

Permalink
Create errorHandler.js
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Dec 4, 2024
1 parent 20c49b3 commit 4413557
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/utils/errorHandler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// utils/errorHandler.js

// Error handling utility
class ErrorHandler {
static handleError(err, req, res) {
console.error(err);
res.status(err.status || 500).json({
success: false,
message: err.message || 'Internal Server Error',
});
}
}

module.exports = ErrorHandler;

0 comments on commit 4413557

Please sign in to comment.