Add error handling middleware