Contents Index Error handling in eMbedded Visual Basic User authentication

UltraLite ActiveX User's Guide
  Understanding UltraLite ActiveX Development
    Error handling

Error handling in JScript


There is no error handling in the version of JScript supported by Pocket IE. The default Pocket IE settings cause script errors to be ignored and the script to be silently terminated. When developing new JScript, this is unacceptable.

Set ShowScriptErrors registry key 

Using a remote registry editor, such as the one that comes with eMbedded Visual Basic, you should create this key on your CE device:

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]ShowScriptErrors=dword:00000001

With this key set, Pocket Internet Explorer will provide error notification messages for JScript code that fails. Note that the line number reported may not be reliable.

Set ErrorResume property 

To suppress UltraLite ActiveX errors, the ULDatabaseManager and ULConnection objects provide the following two properties.

One common area where errors need to be caught is in handling missing database files, which are to be created from a schema. In the following example, the ULDatabaseManager.ErrorResume property is True, so control flows to the next statement following the one causing the error. If the specified database does not exist, the LastErrorCode property is loaded with the error number.

// JScript
DBMgr.ErrorResume = true;   // Do not throw errors
Connection = DBMgr.OpenConnection( udb );
if ( DBMgr.LastErrorCode != 0 ) {
  Connection = DBMgr.CreateDatabase( udb + usm );
  if ( DBMgr.LastErrorCode != 0 ) {
    alert("Connect with " + udb + usm + failed: " + DBMgr.LastErrorCode );
  }
}

Contents Index Error handling in eMbedded Visual Basic User authentication