The exception that is generated when Adobe Commerce returns an error.
The following example generates a
MagentoException due to a non-existing table, and then displays the exception.
public void ThrowMagentoException()
{
string mySelectQuery = "SELECT * FROM NONEXISTINGTABLE";
MagentoConnection adobe commerceConnection =
new MagentoConnection(
"domain=192.168.10.68/magento;user=Test;apikey=testpassword;");
MagentoCommand adobe commerceCommand = new MagentoCommand(mySelectQuery,adobe commerceConnection);
try
{
adobe commerceCommand.Connection.Open();
}
catch (MagentoException myException)
{
MessageBox.Show("Message: " + myException.Message + "\n");
}
}
Public Sub ThrowMagentoException()
Dim mySelectQuery As String = "SELECT * FROM NONEXISTINGTABLE"
Dim adobe commerceConnection As New MagentoConnection( _
"domain=192.168.10.68/magento;user=Test;apikey=testpassword;")
Dim adobe commerceCommand As New MagentoCommand(mySelectQuery, adobe commerceConnection)
Try
adobe commerceCommand.Connection.Open()
Catch myException As MagentoException
MessageBox.Show("Message: " + myException.Message + ControlChars.Cr)
End Try
End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2