using System;

using CommonHelpers;

namespace SqlCatPP {

//**************************************************************************************************
partial class OrderList {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/// <exception cref="ArgumentNullException" />
OperationFailedException CreateListException(string message)
{
   HArgChecking.VerifyNotNull( message );
   var e = LineNo > 0 ?
      OpFailedExceptionCreator.Create(
         "Error in \"{0}\", line #{1}:\n"+
         "{2}", OrderFilePath, LineNo, message ) :
      new OperationFailedException( message );
   e.Data[_FullMessageExceptionKey_] = true;
   return e;
}
/// <exception cref="ArgumentNullException" />
OperationFailedException CreateListException(string messageFmt,params object[] parameters)
{
   return CreateListException( HString.FormatAsText( messageFmt, parameters ) );
}

/// <exception cref="ArgumentNullException" />
/// <exception cref="OperationFailedException" />
void RaiseListError(Exception error)
{
   HArgChecking.VerifyNotNull( error );
   if ( Program.OrderListErrorAsWarn )
      Program.AddWarning( error.Message );
   else
      throw error;
}
/// <exception cref="ArgumentNullException" />
/// <exception cref="OperationFailedException" />
void RaiseListError(string message)
{
   RaiseListError( CreateListException( message ) );
}
/// <exception cref="ArgumentNullException" />
/// <exception cref="OperationFailedException" />
void RaiseListError(string messageFmt,params object[] parameters)
{
   RaiseListError( CreateListException( messageFmt, parameters ) );
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // OrderList
//**************************************************************************************************

} // SqlCatPP
