Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

The Business API does not return any error codes. All error handling is done by exception. This implies that the business system developer should wrap all method calls and accessing properties. Besides the standard exception defined in .NET, the Business API also defines a number of exceptions. For a detailed description of exceptions please refer to the Himsa.Noah.Exceptions Namespace in the BusinessAPI.chm.

The following sample code shows how exception handling is implemented in the sample business system when using the remove method for unboundactions.

private void Remove_Click(object sender, EventArgs e)

        {

           int index = Convert.ToInt32(this.textBox2.Text, 10);

            try

            {

                if (m_actionType == "Actions")

                {

                    m_Session.Actions.Remove(index);

                }

                else

                {

                    m_businessApiObj.UnboundActions.Remove(index);

                }

               

            }

            catch(Noah_E_Action_Already_RemovedException Ex)

            {

                MessageBox.Show(ex.ToString(), "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);

            }

            catch(Exception ex)

            {

                MessageBox.Show(ex.ToString(), "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);

            }

   }



  • No labels