Express middleware for handling Errors in both production and development mode