handle all errors inside the on_mdp_request function and all the child functions