Error handling in Xpage data source

Hi,

In my XPage / Custom Control I have a data source of type dominoView, where the database name is to be set programatically.

What I have observed is that if the database name is not a correct database, then an error message occurs when rendering the XPage. If the database name parameter is set to an empty string, then no error occurs in the data source. But later, when I want to make use of the variable I have stored the data source in, I get an error saying that it is not found.

Are there any good practices on how to do error handling when it comes to data sources in XPages? Any way to “catch” the error, or somehow to check if the data source variable exitst?

I would assume that the problem with a data source not being defined (due to errors in database name, view name, etc) might be a quite common problem?

Any suggestions or experiences are appriciated!

Regards,

Sebjørn Birkeland

Subject: database name parameter on data source

re " If the database name parameter is set to an empty string, then no error occurs in the data source. But later, when I want to make use of the variable I have stored the data source in, I get an error saying that it is not found."

when the database name parameter is null or empty, it is the same as the parameter not being there at all, i.e. the default case is to use the current database. So the view cannot be opened in your current db, which makes sense.

The databaseName param does not have to be a name, but it will support the database replicaId which might solve your problem?

Also you can compute the database name and call some JS code like “session.getDatabase(serverName, databaseName);” to see if the db is up

Subject: …looking into this…