OnError and Script Libaries used in agents

I have an agent that calls a subroutine in a Script Library but not all the agent code is in subroutines in the script library.

I want to be able to trap some errors that occur when processing the subroutine.

When I put an OnError statement in the main agent, any errors that occur cause the agent to use the OnError code in the main agent but then any objects that existed in the subroutine are all lost.

If I try to trap for a specific error in the subroutine, it is ignored in favor on the OnError statements in the main agent.

If I take out the OnError statements in the main agent and put them only in the subroutine, I can properly trap for the errors but then any errors that occur in the main agent code will not be trapped.

Any suggestions? Am I missing something simple?

Thanks

Subject: OnError and Script Libaries used in agents

Hi Terry,OnError is a beast…

What you need to do:

  • trap an Error in every function

  • give the jump label different names (I use FunctionName_err as standard label)

  • I use my own object for error handling (modeled after the NotesLog, but with a stacktrace) and pass it to every function as a parameter to log error conditions

  • Consider using Log4LS (on soureforge)

Hth

:wink: stw

Subject: OnError and Script Libaries used in agents

Could you not just shunt the low level errors back up the stack? Why do you need a handle on the script library objects anyway?

I’d recommend making use of the OpenNTF project “OpenLog” (http://www.openntf.org) – a great error handling / logging solution which supports that kind of funtionality.

Also, Andre Guirard wrote some great articles on error handling and debugging for LDD Today. You can find the first one here:

Debugging Lotusscript, Part 1

Hope that helps.