/**
  * RWFException constructor
  *
  * @param - msg, String the error message to be used.
  * @param Database d the current database
  * @param Document doc the context document.
  */
 public RWFException(String msg, Database d, Document doc) {
   super(msg);
   try {
     Document e = d.createDocument();
     e.replaceItemValue("Form", EXCEPTION_FORM);
     e.replaceItemValue(EXCEPTION_TYPE_FIELD, "Workflow Exception");
     e.replaceItemValue(EXCEPTION_MSG_FIELD, msg);
     RichTextItem rt = e.createRichTextItem(EXCEPTION_DOCLINK_FIELD);
     rt.appendDocLink(doc);
     e.save();
   } catch (NotesException e) {
     e.printStackTrace();
     System.out.println(e.text);
   }
 }