Add api to return failure information