Error Handling_N4 Business System API



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);

            }

   }


Below is a list of possible errors but several is obsolete.

public enum NOAHErrorType
{
NoahError = -2147221504, // 0x80040000
NOAH_VARIANT_ERROR = -2147220992, // 0x80040200
NOAH_E_VARIANT_WRONG_VT = -2147220991, // 0x80040201
NOAH_E_VARIANT_TOO_MANY_DIMENSIONS = -2147220990, // 0x80040202
NOAH_E_VARIANT_UNABLE_TO_READ = -2147220989, // 0x80040203
NOAH_E_VARIANT_UNABLE_TO_WRITE = -2147220988, // 0x80040204
NOAH_E_VARIANT_SAFEARRAY_TOO_LONG = -2147220987, // 0x80040205
NOAH_E_VARIANT_SAFEARRAY_TOO_SHORT = -2147220986, // 0x80040206
NOAH_E_VARIANT_SAFEARRAY_LENGTH_MISMATCH = -2147220985, // 0x80040207
NOAH_E_VARIANT_SAFEARRAY_INVALID_DATA = -2147220984, // 0x80040208
NOAH_E_VARIANT_SAFEARRAY_INVALID = -2147220983, // 0x80040209
NOAH_E_VARIANT_SAFEARRAY_ILLEGAL_DIMENSIONS = -2147220982, // 0x8004020A
NOAH_DB_ERROR = -2147220960, // 0x80040220
NOAH_E_DB_UNKNOWN_PROPRIETARY_ERROR = -2147220959, // 0x80040221
NOAH_E_DB_BAD_OBJECT = -2147220958, // 0x80040222
NOAH_E_DB_UNABLE_TO_ACCESS_DB = -2147220957, // 0x80040223
NOAH_E_DB_CLIENT_NOT_FOUND = -2147220956, // 0x80040224
NOAH_E_DB_USER_NOT_FOUND = -2147220955, // 0x80040225
NOAH_E_DB_SETUP_NOT_FOUND = -2147220954, // 0x80040226
NOAH_E_DB_SESSION_NOT_FOUND = -2147220953, // 0x80040227
NOAH_E_DB_ACTION_NOT_FOUND = -2147220952, // 0x80040228
NOAH_E_DB_ACTIONREF_NOT_FOUND = -2147220951, // 0x80040229
NOAH_E_DB_PRODUCT_NOT_FOUND = -2147220950, // 0x8004022A
NOAH_E_DB_PRODUCTREF_NOT_FOUND = -2147220949, // 0x8004022B
NOAH_E_DB_PREFERENCE_NOT_FOUND = -2147220948, // 0x8004022C
NOAH_E_DB_PREFERENCE_ALLREADY_EXISTS = -2147220947, // 0x8004022D
NOAH_E_DB_UNBOUNDACTION_NOT_FOUND = -2147220946, // 0x8004022E
NOAH_E_DB_UNBOUNDACTIONREF_NOT_FOUND = -2147220945, // 0x8004022F
NOAH_E_DB_UNABLE_TO_READ_PREF_DB_GUID = -2147220944, // 0x80040230
NOAH_E_DB_OBJECT_NOT_FOUND = -2147220943, // 0x80040231
NOAH_E_DB_SCOPE_NULL = -2147220942, // 0x80040232
NOAH_SERVER_ERROR = -2147220912, // 0x80040250
NOAH_E_NS_REG_DATATYPE = -2147220911, // 0x80040251
NOAH_E_NS_REG_MODULECATEGORY = -2147220910, // 0x80040252
NOAH_E_NS_REG_MANUFACTURER = -2147220909, // 0x80040253
NOAH_E_NS_REG_PRODUCTCATEGORY = -2147220908, // 0x80040254
NOAH_E_NS_DB_NOT_AVAILABLE = -2147220907, // 0x80040255
NOAH_E_NS_MANUFACTURER_NOT_FOUND = -2147220906, // 0x80040256
NOAH_E_NS_COOKIE_NOT_FOUND = -2147220905, // 0x80040257
NOAH_E_NS_REG_LICENSE = -2147220904, // 0x80040258
NOAH_E_NS_UNABLE_TO_ACCESS_STGFILE = -2147220903, // 0x80040259
NOAH_E_NS_INVALID_LICENCE = -2147220902, // 0x8004025A
NOAH_E_NS_MAXUSERS_EXCEEDED = -2147220901, // 0x8004025B
NOAH_E_NS_STGTRANSFER_FAILED = -2147220900, // 0x8004025C
NOAH_E_NS_LICENCE_EXPIRED = -2147220899, // 0x8004025D
NOAH_E_NS_LICENCE_CLOCK_TURNED_BACK = -2147220898, // 0x8004025E
NOAH_E_NS_INVALID_LICENCE_FOR_NOAH_SYSTEM = -2147220897, // 0x8004025F
NOAH_E_NS_LICENCE_ONLY_VALID_FOR_NOAH_SYSTEM = -2147220896, // 0x80040260
NOAH_E_NS_LICENCE_WMISERVICE_NOT_STARTED = -2147220895, // 0x80040261
NOAH_E_NS_LICENCE_HARDWARE_CHANGED = -2147220894, // 0x80040262
NOAH_E_NS_LICENCE_BLACKLISTED = -2147220893, // 0x80040263
NOAHCLIENT_ERROR = -2147220480, // 0x80040400
NOAHCLIENT_E_CANT_BROWSE_REGISTRY = -2147220480, // 0x80040400
NOAHCLIENT_E_CANT_LAUNCH_NOAHSERVER = -2147220479, // 0x80040401
NOAHCLIENT_E_MODULE_ALREADY_INSTALLED = -2147220478, // 0x80040402
NOAHCLIENT_E_ORPHANOUTOFDATE = -2147220477, // 0x80040403
NOAHCLIENT_E_UNABLE_TO_INSTALL = -2147220476, // 0x80040404
NOAHCLIENT_E_NO_USER = -2147220475, // 0x80040405
NOAHCLIENT_E_NO_CLIENT = -2147220474, // 0x80040406
NOAHCLIENT_E_NO_MODULES = -2147220473, // 0x80040407
NOAHCLIENT_E_UNABLE_TO_NOTIFY = -2147220472, // 0x80040408
NOAHCLIENT_E_MODULE_NOT_RUNNING = -2147220471, // 0x80040409
NOAHCLIENT_E_NO_LATESTSESSION = -2147220470, // 0x8004040A
NOAHCLIENT_E_TO_MANY_MODULES = -2147220469, // 0x8004040B
NOAHCLIENT_E_UNABLE_TO_UNINSTALL = -2147220468, // 0x8004040C
NOAHCLIENT_E_CANT_RETRIEVE_SETTINGS = -2147220467, // 0x8004040D
NOAHCLIENT_E_TRANSACTION_STARTED = -2147220466, // 0x8004040E
NOAHCLIENT_E_COULDNT_REGISTER_MODULE = -2147220465, // 0x8004040F
NOAHCLIENT_E_MODULES_RUNNING = -2147220464, // 0x80040410
NOAHCLIENT_E_COULDNT_CREATE_ACTIONCOLL = -2147220463, // 0x80040411
NOAHCLIENT_E_COULDNT_LAUNCH_MODULE = -2147220462, // 0x80040412
NOAHCLIENT_E_UNABLE_TO_INSTALL_ACTIONCONVERTER = -2147220461, // 0x80040413
NOAHCLIENT_E_UNABLE_TO_UNINSTALL_ACTIONCONVERTER = -2147220460, // 0x80040414
NOAHCLIENT_E_ACTIONCONVERTER_NOT_FOUND = -2147220459, // 0x80040415
NOAHCLIENT_E_INSTALL_ACTIONCONVERTER_UPDATE = -2147220458, // 0x80040416
NOAHCLIENT_E_STGTRANSFER_FAILED = -2147220457, // 0x80040417
NOAHCLIENT_E_COULDNT_QUERY_CLIENT = -2147220456, // 0x80040418
NOAHCLIENT_E_NOAHSERVER_NOT_RUNNING = -2147220455, // 0x80040419
NOAHCLIENT_E_SERVER_NOT_CONNECTED = -2147220454, // 0x8004041A
NOAH_DISPATCH_ERROR = -2147220224, // 0x80040500
NOAH_E_OBJECT_REMOVED = -2147220224, // 0x80040500
NOAH_E_OBJECT_READONLY = -2147220223, // 0x80040501
NOAH_E_OBJECT_NOT_FOUND = -2147220222, // 0x80040502
NOAH_E_OBJECT_COULD_NOT_READ_PROPERTY = -2147220221, // 0x80040503
NOAH_E_OBJECT_COULD_NOT_WRITE_PROPERTY = -2147220220, // 0x80040504
NOAH_E_SESSION_NOT_CURRENT = -2147220219, // 0x80040505
NOAH_E_ACTION_ALREADY_REMOVED = -2147220218, // 0x80040506
NOAH_E_ACTION_NOT_REMOVED = -2147220217, // 0x80040507
NOAH_E_PRODUCT_ALREADY_REMOVED = -2147220216, // 0x80040508
NOAH_E_PRODUCT_NOT_REMOVED = -2147220215, // 0x80040509
NOAH_E_NOT_INITIALIZED = -2147220214, // 0x8004050A
NOAH_E_ALREADY_INITIALIZED = -2147220213, // 0x8004050B
NOAH_E_NO_CURRENT_USER = -2147220212, // 0x8004050C
NOAH_E_NO_CURRENT_CLIENT = -2147220211, // 0x8004050D
NOAH_E_INTERNAL_ERROR = -2147220210, // 0x8004050E
NOAH_E_MODULE_NOT_SAME = -2147220209, // 0x8004050F
NOAH_E_ACTION_DESCRIPTION_EMPTY = -2147220208, // 0x80040510
NOAH_E_BAD_IMCSERVER = -2147220207, // 0x80040511
NOAH_E_NO_PRINTHANDLER = -2147220206, // 0x80040512
NOAH_E_ILLEGAL_IMODULEPRINT = -2147220205, // 0x80040513
NOAH_E_ERROR_LOADING_LEGACYPRINTHANDLER = -2147220204, // 0x80040514
NOAH_E_CAN_NOT_CREATE_PRINTER_DC = -2147220203, // 0x80040515
NOAH_E_INVALID_DATATYPE = -2147220202, // 0x80040516
NOAH_E_DATATYPE_READONLY = -2147220201, // 0x80040517
NOAH_E_MODULE_NOT_INSTALLED = -2147220200, // 0x80040518
NOAH_E_ILLEGAL_CATEGORY = -2147220199, // 0x80040519
NOAH_E_NOSPACE = -2147220198, // 0x8004051A
NOAH_E_NOCONVERTER = -2147220197, // 0x8004051B
NOAH_E_NOTLEGAL = -2147220196, // 0x8004051C
NOAH_E_NOTSUPPORTED = -2147220195, // 0x8004051D
NOAH_E_UNABLE_TO_LAUNCH_IMCSERVER = -2147220194, // 0x8004051E
NOAH_E_CREATE_CLIENT = -2147220193, // 0x8004051F
NOAH_E_STGTRANSFER_FAILED = -2147220192, // 0x80040520
NOAH_E_UNABLE_TO_CREATE_DC = -2147220191, // 0x80040521
NOAH_E_ACTIONCOLL_NOT_AVAILABLE = -2147220190, // 0x80040522
NOAH_E_REPORTGENERATOR_NOT_INSTALLED = -2147220189, // 0x80040523
NOAH_E_ACTION_NOT_FOUND_IN_DB = -2147220188, // 0x80040524
NOAH_E_MAX_SETUPBLOBSIZE_EXCEEDED = -2147220187, // 0x80040525
NOAH_E_MAX_PUBLICBLOBSIZE_EXCEEDED = -2147220186, // 0x80040526
NOAH_E_MAX_PRIVATEBLOBSIZE_EXCEEDED = -2147220185, // 0x80040527
NOAH_E_NO_PARENT = -2147220184, // 0x80040528
NOAH_E_NO_OFFICESERVER_RUNNING = -2147220183, // 0x80040529
NOAH_E_UNBOUNDACTION_ALREADY_REMOVED = -2147220182, // 0x8004052A
NOAH_E_UNBOUNDACTION_NOT_REMOVED = -2147220181, // 0x8004052B
NOAH_E_MAX_MANUFACTURERBLOBSIZE_EXCEEDED = -2147220180, // 0x8004052C
NOAH_E_MAX_FASTVIEWBLOBSIZE_EXCEEDED = -2147220179, // 0x8004052D
}

Â