Anonymous
Domino 2.0 Rich Internet Applications with IBM Lotus Notes/Domino
You are here: Today » Domino Workspace: LotusScript timing and error tracking
« Domino Workspace: the WebSession class
Announcing Domino Workspace »

Domino Workspace: LotusScript timing and error tracking

Domino Workspace is intended to leverage most of the functionalities of Lotus Quickr, but by using IBM Lotus Notes/Domino only. I am developing this online, so you can follow the progress by clicking on the second tab on top of this page. The interface is almost completely rendered by WebQueryOpen agents. In this entry, I'll explain the basic LotusScript techniques I use.

Notes Butter

Jake Howlett on CodeStore released his Notes Butter nsf this week. It containes an incredible list of features and techniques to use for programming web applications with Domino and Ajax. I like especially the idea of the WebSession class and the HtmlArea class. One tiny bit of his code however made my day: a very clever way of having a real LINEFEED constant:

Const NEWLINE=|
|

Timing the LotusScript

Since performance is my first concern, I measure the processing time of all my agents, making use of GetThreadInfo.

Dim start As Long
start=Getthreadinfo(6)

'the code goes here

ws.debug |WQO Agent finished in | & Format((Getthreadinfo(6)-start)/Getthreadinfo(7), "0.00") & | sec.|

Debugging WebQueryOpen agents

This can be quite tricky, since normally a WebQueryOpen agent just goes dead when an error happens. So I use a field "WqoDebug" on the page to render the debug info. For error trapping, I found the ideas of Ferdy Christant very inspiring. He states that all errors should bubble up and finally trapped in the top module.

Error bubbles up

Function getSomethingByKey(Byval key As String)
    On Error Goto catch

' code goes here

    Goto finally
catch:
    Error Err, Error & " in " & Getthreadinfo(1) & ", line " & Erl
    Resume finally
finally:    

End Function

Error trapped in top module

Sub Initialize
    On Error Goto catch

' code goes here

    Goto finally
catch:
    ws.debug "Error " & Err & " in line " & Erl & ": " & Error$
    Resume finally
finally:
    ws.doc.replaceitemvalue "WqoDebug", ws.debugStack.collapse("<br />" & NEWLINE)
End Sub

Star rating

0%

Comments

  1. 29/08/2007 14:46:05, Sean Burgess

    When it comes to error trapping, OpenLog on OpenNTF is the current Gold Standard. You might want to look to integrate it into your Workspace.

  2. 29/08/2007 20:29:42, Fabian Robok

    Julian Robichaux is a living manufacturing line for masterpieces, but there still might be reasons to not use OpenLog, sometimes. And if you don't, it's a good idea to stick to the same principles for error handling.

    And I plain love the idea of simulating a finally block! So simple, yet I never thought of it. Great!

To add a comment, log in or register as new user. It's free and safe.