manage error in middleware