dotConnect for FreshBooks Documentation
Devart.Data.FreshBooks Namespace / FreshBooksException Class
Members Example

In This Topic
    FreshBooksException Class
    In This Topic
    The exception that is generated when FreshBooks returns an error.
    Syntax
    Remarks
    This class is created whenever dotConnect for FreshBooks encounters an error generated by the server, or FreshBooksConnection has been closed before attempting to execute an operation on the server.
    Example
    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
    Inheritance Hierarchy

    System.Object
       System.Exception
          System.SystemException
             System.Runtime.InteropServices.ExternalException
                System.Data.Common.DbException
                   Devart.Data.FreshBooks.FreshBooksException

    Requirements

    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

    See Also