User-defined error

When I setup in LotusScript an own error handling I get information like error code and error text. This works fine. But in in some cases like error code 1024 or 4005 I get only the simple error text ‘User-defined error’. Unfortunately not the concrete reason for the error. See following samples.

  1. Sample

Dim l As Long

l = Clng(“a”)

own error handling is running: error code 13, error text ‘Type mismatch’

own error handling is not running also: error text ‘Type mismatch’

That is fine.

  1. Sample

Dim v As Variant

v = Evaluate(Cvar(“@Xrue”))

own error handling is running: error code 1024, error text ‘User-defined error’

own error handling is not running but: error text ‘Operation failed’

That is not fine. I want to get in this case also the concrete error text ‘Operation failed’ not the global error text ‘User-defined error’

  1. Sample

Dim session As NotesSession

Dim db As NotesDatabase

Dim coll As NotesDocumentCollection

Set session = New NotesSession

Set db = session.CurrentDatabase

Set coll = db.FTSearch(“X[F1] CONTAINS A”, 0)

own error handling is running: error code 4005 , error text ‘User-defined error’

own error handling is not running but: error text ‘Notes error: Query is not understandable (X[F1] CONTAINS A)’

That is not fine. I want to get in this case also the concrete error text ‘Notes error: Query is not understandable (X[F1] CONTAINS A)’ not the global error text ‘User-defined error’

The error codes 1024 and 4005, respectively, above are unfortunately concretely. Why Notes cannot provide the concrete error text in this case also like in the 1. sample. In addition, the error code 4005 can have a lot of reasons, in example ‘Notes error: Not enough workspace for full-text indexing or query…’. The same is for the other error codes like 4000, 4001…

How can I get the the concrete error text also in this case?

Excuse me for my bad English, I am a German user.

Thank you in advance for any answer.

Subject: User-defined error

Are you trapping the error in one subroutine and processing it in another subroutine? The error message for 1024 and 4005 really is “user-defined error”, but you should not be seeing those error codes in those situations.

Sub Click(Source As Button)

Error( 1024 )

End Sub

results in “user-defined error”

Sub Click(Source As Button)

Evaluate(Cvar("@Xrue"))

End Sub

results in “Operation Failed”

Subject: RE: User-defined error

I want to handle the error by myself. I get the concrete error message only if I handle eroors not by myself. But I want handle all errors by myself, also by error code 1024, 4005 and so on. But I want to get also the concrete error text not only ‘User-defined error’. In case of an error I want to put out an complete error text with error code, error text and error line.

Subject: RE: User-defined error

Well, then, do that. The error is occuring outside of LotusScript (which is why you get a generic error), but you know what line failed and can supply your own error message to the logs, etc.

Subject: RE: User-defined error

This is not possible in case of error code 4005 or other codes 4000, 4001… Then error code 4005 has a lot of different errors. How can I get the right error when I get only error code 4005 and error text ‘User-defined error’.In example: Doing FTSearch bring up error code 4005 in case of query is not understandable, but also error code 4005 can mean there is not enough workspace for searching, an so on many other reasons. When I get now error code 4005, how can I get the right error text from all possible eroor text in this case? I want to put out only the the right error text.

Subject: User-defined error

Unfortunately, this is how it works. My impression is that if there is more “hierarchy levels” of code/compilation, it is not able to give you the correct error number.

You may try to add your own error catches like

On error 1024 goto EVAL_ERROR

These should work I suppose.