Skip to main content

General exception handling

Within your code, you can use an exception called QvxPleaseSendReplyException(QvxResult result, string message). QvxResult should be one of those specified in the QVX file format.

QVX file format

When throwing a QvxPleaseSendReplyException, QvxLibrary catches it and sends a QvxReply to QlikView or Qlik Sense containing the specified result and message.

Connector reply.

The following code example, taken from QvEventLogConnection.cs within the QvEventLogConnectorElaborate example connector, shows a typical throwing of a QvxPleaseSendReplyException:

private IEnumerable<QvxDataRow> GetEvents(string log, string tableName)

{

//...

if (EventLog.Exists(tableName))

{

throw new QvxPleaseSendReplyException(QvxResult.QVX_TABLE_NOT_FOUND,

String.Format("There is no EventLog with name: {0}", tableName));

}

// ...

}

When QlikView or Qlik Sense receives the QvxReply, it displays a message box similar to the following one:

Script Error popup with warning QVX_TABLE_NOT_FOUND: There is no EventLog with name: EXAMPLENAME SQL SELECT * FROM EXAMPLENAME

When your application throws an exception other than QvxPleaseSendReplyException, QvxLibrary catches it and does two things:

  1. First, it writes the stack trace for the exception to a file called “StackTrace.txt”, which is located in the same folder as the log file.
  2. Then QvxLibrary sends a QvxReply to QlikView or Qlik Sense with result set to QVX_UNKNOWN_ERROR and message set to the ErrorMessage of the thrown exception.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!