//----------------------------------------------------------------------- // // Copyright (c) Outercurve Foundation. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOpenAuth { using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Globalization; using System.Linq; using System.Text; /// /// Error reporting methods specific to InfoCard validation. /// internal static class InfoCardErrorUtilities { /// /// Checks a condition and throws an /// if it evaluates to false. /// /// The condition to check. /// The message to include in the exception, if created. /// The formatting arguments. /// Thrown if evaluates to false. [Pure] internal static void VerifyInfoCard(bool condition, string errorMessage, params object[] args) { Requires.NotNull(args, "args"); Contract.Ensures(condition); Contract.EnsuresOnThrow(!condition); Contract.Assume(errorMessage != null); if (!condition) { errorMessage = string.Format(CultureInfo.CurrentCulture, errorMessage, args); throw new InfoCard.InformationCardException(errorMessage); } } } }