This can replace all the existing error responses and can be used to catch all errors.
A function that sets the error code and msg can be used throughout the codebase with this.
Error response through this middleware must be like this:
{
success: false,
msg: "Custom/Default Error Message"
}