Process middlewares and handlers error.