How does `ThrowOnFailure` behave? What kind of exception does it throw upon failure?