Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2011
    Posts
    36

    Unanswered: Cleaning up error messages

    Is there any way, when using SIGNAL, to clean up the error message so it is a bit more user-friendly? That is, the message text I set in a trigger may be "You really messed up this time. Call the developer and confess", but the message that is displayed for the user is this:

    [IBM][CLI Driver][DB2/NT64] SQL0438N Application raised error or warning with diagnostic text: "You really messed up this time. Call the developer and confess". SQLSTATE=75002

    I can interpret the whole message easily enough, but the only time I use SIGNAL is to generate a user-level message without having to modify code in the application calling the trigger, and the end user is quite likely to miss the germane portion "You really messed up this time. Call the developer and confess" amongst all the technical IBM/DB2 information.

  2. #2
    Join Date
    Apr 2012
    Posts
    1,035
    Provided Answers: 18
    Depends on the application architecture - your example appears to show a CLI application (such as the command line etc).
    Applications can catch DB2 errors if they are coded to do so, and once caught, the application can decide how to handle the exception.
    Part of that handling is deciding if and how to present the error to the end-user (which might include translating / reformatting the text as required).
    When applications use built-in (default) error handling then the built-in presentation of the message appears, and I don't know a way to change that.

  3. #3
    Join Date
    Feb 2011
    Posts
    36
    Thank you. That helps me understand at what level the messages are processed. I am just trying to add custom logic (via triggers) to an application where we have full control over the DB2 database but not over the EXEs that are provided by the third-party software developers.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •