FreshBooksException Class
The exception that is generated when FreshBooks returns an error.
The following example generates a
FreshBooksException due to a non-existing table, and then displays the exception.
|
|---|
public void ThrowFreshBooksException()
{
string mySelectQuery = "SELECT * FROM NONEXISTINGTABLE";
FreshBooksConnection freshBooksConnection =
new FreshBooksConnection(
"API Version=Alpha;Access Token=3d3355b2beea67f9241400fbe28f0b116e3efd2f8a85dda3c35620acdc95cd60;Refresh Token=75836f50da63fc5bf81bb24598511ae131ea422e73d9f321b4c4a44e2dd1c67f;Company Name=Devart");
FreshBooksCommand freshBooksCommand = new FreshBooksCommand(mySelectQuery,freshBooksConnection);
try
{
freshBooksCommand.Connection.Open();
}
catch (FreshBooksException myException)
{
MessageBox.Show("Message: " + myException.Message + "\n");
}
} |
|
|---|
Public Sub ThrowFreshBooksException()
Dim mySelectQuery As String = "SELECT * FROM NONEXISTINGTABLE"
Dim freshBooksConnection As New FreshBooksConnection( _
"API Version=Alpha;Access Token=3d3355b2beea67f9241400fbe28f0b116e3efd2f8a85dda3c35620acdc95cd60;Refresh Token=75836f50da63fc5bf81bb24598511ae131ea422e73d9f321b4c4a44e2dd1c67f;Company Name=Devart")
Dim freshBooksCommand As New FreshBooksCommand(mySelectQuery, freshBooksConnection)
Try
freshBooksCommand.Connection.Open()
Catch myException As FreshBooksException
MessageBox.Show("Message: " + myException.Message + ControlChars.Cr)
End Try
End Sub |