using System;

namespace CommonHelpers {

//**************************************************************************************************
public static partial class HUnsuccessExceptionCreator {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/// <exception cref="ArgumentNullException" />
public static HUnsuccessException Create(string messageFmt,params object[] parameters)
{
   HArgChecking.VerifyNotNulls( messageFmt, parameters );
   return new HUnsuccessException(string.Format( messageFmt, parameters ));
}
/// <exception cref="ArgumentNullException" />
public static HUnsuccessException Create(Exception e)
{
   HArgChecking.VerifyNotNull( e );
   return new HUnsuccessException( e.Message );
}

//==================================================================================================

/// <exception cref="ArgumentNullException" />
/// <exception cref="HUnsuccessException" />
public static void Do(Action action)
{
   HArgChecking.VerifyNotNull( action );
   try { action(); }
   catch (Exception e)
      { throw Create( e ); }
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // HUnsuccessExceptionCreator
//**************************************************************************************************

} // CommonHelpers
