Wednesday, October 27, 2010

XPages: New methods to the Debug class

I added couple of new methods to the Debug class.

Debug.messageToPage( message:String ): Adds a message to the bottom of the page.
Example usage:
..
Debug.messageToPage( viewScope.someValue )
..
Debug.exceptionToPage( exception:String ): Adds exception message to the bottom of the page
Example usage:
function someFunction(){
try {
..
} catch( exception ){ Debug.exceptionToPage( exception ) }
}
Each call to the function results in a line being added to the "message box". The code for the Debug class can be found here.

The messages are displayed in a "validation error" type box (xspMessage).

I would think messageToPage is the most useful, as an exception may crash the entire page/the message box won't be rendered.

Share and enjoy!

0 comments: