Exception Messages

FDO API

 
Exception Messages
 
 
 

Exception messages are localized. On Windows the localized strings are in resource-only DLLs, and on Linux they are in catalogs. The message DLLs are in the bin folder; the DLL name contains Message or Msg. The catalog files are in the /usr/local/fdo-3.2.0/nls directory; the names of these files ends in .cat. NLS stands for National Language Support.

On Linux set the NLSPATH environment variable so that the runtime code can locate the message catalogs. For example, export NLSPATH=/usr/local/fdo-3.2.0/nls/%N.

On Windows you do not have do anything special to enable the runtime code to locate the message DLLs.

The contents of the exception message files are indexed. When you call one of the FdoException::NLSGetMessage methods declared in Exception.h, you provide a message number argument. You may also provide a default message string argument. In the event that the exception message resource file cannot be found, the default message is subsituted instead. If the default message string is not provided and the resource file cannot be found, the message number is used as the exception message. Not finding the resource file can only happend on Linux and only if the NLSPATH envrionment variable is not set.

The following two examples, when called on Linux with the NLSPATH environment variable not set, show the use of the default message and the message number in the exception message.

The following is an example of using the default string: throw FdoSchemaException::Create(NlsMsgGet1(FDORDBMS_333, "Class '%1$ls'not found", value->GetText()));

The following is an example of not setting the default string and using the message number instead: FdoSchemaException* pNewException = FdoSchemaException::Create( FdoSmError::NLSGetMessage(FDO_NLSID(FDOSM_221), pFeatSchema->GetName()), pException);.