Create onFail method.