I have an application with a module that can return a range of error codes. I would like to be able to turn these codes into meaningful text messages, and I use Constants, like this:
Public Const ERR_UI_4402 = “NO WORKSPACE”
Public Const ERR_UI_4403 = “NO DATABASE”
Public Const ERR_UI_4404 = “DB CREATE ERROR”
Public Const ERR_UI_4405 = “NO DOCUMENT”
What I would like to do is to be able to get the translation from code to text programatically, not have to test each code like this:
If code = 4404 then Messagebox ERR_UI_4404
If code = 4405 then Messagebox ERR_UI_4405 etc.
This needs something equivalent to a FieldGetText command, but these are not field values.
you can create your own error code / message sets and then use them as if they were predefined. Just include a line similar to this one:
On Error Goto ErrHdl
…
If (error condition) then
Error YOUR_ERROR_CONSTANT, “Your error message”
End if
…
ErrHdl:
MsgBox "Error " & Cstr(Err) & ": " & Error$
Resume whatever
For a more complete example you may want to have a look at your Domino Designer’s help file; look for “Err statement” (NOT Err function, though) and then open the example. The example has been the same since at least ND 6 so it doesn’t matter which version you’re actually using.
My sincere apologies if I got your question completely wrong…