Skip navigation FileNet logo
  Open Client Developer's Guide
  Search  |  Index  |  Glossary   |  
Open menu Overview
Open menu Open Client Architecture
Open menu Developing for Process
Close menu Error and Exception Handling
  Open menu Error Handling
  Close menu Exception Handling
    Defining a New Exception
    Error Helper Functions
    Handling Guidelines
    Handling COMException
    Logging Exceptions
Open menu Customizing the Framework
Globalization / Localization
Open menu General Information
   

Defining a New Exception

In ASP.NET, developers can define a new exception class to take different actions based on the exception class. To do this, use the FnWSException exception for throwing the Open Client exception, which is defined in FnOpenClient. FnWSException is the base exception class for all other Open Client exceptions.

Note: All error-related classes are defined in ..\Program Files\FnOpenClient\UTIL\ FnError.vb.

When defining a new exception class, follow these guidelines:

  • Append the class name with the suffix “Exception”.
  • Derive the new exception class from FnWsException, rather than ApplicationException or Exception.

Exception Naming Conventions

For detailed information regarding the naming conventions or error messages, see Error Naming Conventions.

Note: When several enumertor types share the same exception class, unique identifiers should be used.

When throwing an exception, use the FnResourceManager to obtain the correct localized string as follows:

throw new FnWSException (rm.GetResourceString("FN_ERR_SEARCH_FileNotFound")

Use the placeholder {n} to specify the portion of the error message that should be supplied at runtime. For example:

FN_ERR_SEARCH_LibraryNotFound=The search target library {1} does not exist.

The strings that will replace the error message placeholders at runtime, should be passed in as an array of strings. The first placeholder in the error message will be replaced by the first element of the string array, the second place holder, the second element of the string array, and so on. The following code fragment demonstrates the use of an array of strings:

Params(0) = “pin3ms^pinta”.
rm.GetResourceStringWParam("FN_ERR_SEARCH_LibraryNotFound", params)

The completed error message that will be returned is:

“The search target library pin3ms^pinta does not exist.”