Use response handler in handleErrors middleare
This commit is contained in:
1 parent
e9eadfe838
commit
9f43336a03
4 files changed
+11
-5
No files matched your search
@@ -7,8 +7,8 @@ const responseHandler = (req, res, next) => {
|
||||
});
|
||||
};
|
||||
|
||||
res.error = (status = 500, msg = "Internal server erro", data = null) => {
|
||||
res.status(status).json({
|
||||
res.error = ({ status = 500, msg = "Internal server erro", data = null }) => {
|
||||
return res.status(status).json({
|
||||
success: false,
|
||||
msg,
|
||||
data,
|
||||
|
||||
Reference in new issue
Block a user