Add a try/catch block in your code. If there's an error, call
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, e.getMessage(), e.getMessage()));
DominoUtils.handleException(e);
The first line is effectively what the XspOpenLogItem is doing. “e” will be your Exception or Throwable. You could add that code into a static utility method, for regular usage.