Error handling in the user mapping plug-in (C programming language)

The user mapping plug-in uses the FSUMlogErrorMsg function to log all error and informational messages in the db2diag.log file.

If a function call is successful, the plug-in returns FSUM_PLUGIN_OK. If the call is not successful, the plug-in returns an error code. The following table describes the errors.

Table 1. Errors for the user mapping plug-in
Error number Constant name Error message Functions that return the error Error code
0 FSUM_PLUGIN_OK The plug-in ran successfully.
  • FSUMPluginInit
  • FSUMconnect
  • FSUMfetchUM
  • FSUMdisconnect
  • FSUMPluginTerm
SQL_SUCCESS (No error)
1 FSUM_INITIALIZE_ERROR The plug-in failed to initialize.
  • FUMPluginInit
SQL20349N , reason code 1
2 FSUM_PLUGIN_VERSION_ ERROR The plug-in version is wrong.
  • FUMPluginInit
SQL20349N, reason code 2
3 FSUM_CONNECTION_ ERROR Unable to connect to the external repository.
  • FSUMPluginInit
SQL20349N, reason code 3
4 FSUM_LOOKUP_ERROR Lookup on the repository failed.
  • FSUMfetchUM
SQL20349N, reason code 4
5 FSUM_DECRYPTION_ERROR Decryption failed.
  • FSUMfetchUM
SQL20349N, reason code 5
6 FSUM_DISCONNECT_ERROR Unable to disconnect from the repository.
  • FSUMdisconnect
SQL20349N, reason code 6
7 FSUM_INVALID_ PARAMETER_ERROR Invalid parameter.
  • FSUMfetchUM
  • FSUMdisconnect
  • FSUMPluginTerm
SQL20349N, reason code 7
8 FSUM_UNAUTHORIZED_ CALLER The caller is not authorized to call the plug-in.
  • FSUMPluginInit
SQL20349N, reason code 8
9 FSUM_AUTHENTICATION_ ERROR Unable to authenticate with the repository.
  • FSUMconnect
SQL20350N, no reason code
10 FSUM_TERMINATION_ ERROR Failure to clean up a resource at the plug-in level.
  • FSUMPluginTerm
SQL20349N, reason code 9
Not a number from 0 to 10   Unknown error occurred.
  • FSUMPluginInit
  • FSUMconnect
  • FSUMfetchUM
  • FSUMdisconnect
  • FSUMPluginTerm
SQL20349N, reason code 10

The plug-in can also use the FSUMlogErrorMsg utility function to log messages to the db2diag.log file. To specify the severity of the messages, use FSUM_LOG_CRITICAL, FSUM_LOG_ERROR, FSUM_LOG_WARNING, or FSUM_LOG_INFO.

When you use the test program to test the plug-in, messages are printed directly to the screen.