//**************************************************************************************************
// INTERNAL INTERACTION EXCEPTION "InternalInteropException" (FOR PUBLIC API ERROR):
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#pragma once

namespace XDeviceAccess {

/// Internal interaction exception (for library API-error)
public ref class InternalInteropException: HException
{
public:
   InternalInteropException(): HException() {}
   InternalInteropException(String^ message): HException(message) {}
}; // InternalInteropException

/// Internal interaction exception creator (helper class)
ref class IntInteropExceptionCreator
{
private:
   IntInteropExceptionCreator() {}
public:
   /// <exception cref="ArgumentNullException" />
   static InternalInteropException^ Create( String^ messageFmt,
                                             ... array<Object^>^ parameters )
   {
      HArgChecking::VerifyNotNulls( messageFmt, parameters );
      return gcnew InternalInteropException( String::Format(messageFmt,parameters) );
   }
   /// <exception cref="ArgumentNullException" />
   static InternalInteropException^ Create(Exception^ error)
   {
      return gcnew InternalInteropException( HException::GetMessage( error ) );
   }

   static InternalInteropException^ CreateFromWin32Error()
   {
      return CreateFromWin32Error( HWin32Error::LastErrorCode );
   }
   static InternalInteropException^ CreateFromWin32Error(int errorCode)
   {
      return gcnew InternalInteropException( HWin32Error::ErrorCodeToMessage( errorCode ) );
   }
};

} // XDeviceAccess
