Error Handling
Contents
Overview
Error handling within QSAS derives directly from the error handling within the DVOS core objects.
An essential principle of DVOS is that it will return a valid object even when an operation is invalid. Both the object and its var pointer will return true for the is_nil() test and false for is_ok().
However, an 'invalid' object is actually an object holding a single
double value (0.0) but with an id of -1. This ensures that it will not
crash if not tested immediately, and also allows for error messages to
be attached to the returned object.
Error messages attached to an object usually pertain to the last
operation, but may accumulate if new objects are not being created. QSAS
error handling provides access to these messages, as well as locally
generated messages when the returned object is invalid ( is_nil() returns true ).
DVOS Error Methods
For plugin coding it can be useful to access the DVOS error handling directly.
void clearError() empties the object's error list.
void error(const char*flag) appends the message flag to the object's error list.
DvString getError(size_t i) returns the error message at position i on the object's error list. Default is the last error appended.
int nError() returns the number of error messages on the object's error list. Returns zero if no errors have been detected.
Viewing Object Errors in QSAS
If an operation to create an object did not complete as expected, then
the resulting object will have one or more error messages attached to
it.
Most windows in QSAS have their own feedback area (and the Main Window
uses the bottom bar for feedback). Thus for most errors encountered the
operation will be trapped immediately and feedback, including the DVOS
message, will be shown in the relevant feedback area.
In some instances, however, an object (possibly 'invalid') will be
placed on the Working List. When an object with errors is browsed
(double clicked) it will display errors, if there are any, towards the
bottom of the browser window. If the error is not serious the error flag
can be cleared using the Clear Errors button.
Viewing Errors in the Calculator
Since errors are trapped after each step in a calculation the error
feedback is attached to the operation that failed. If a calculation did
not proceed through, a red triangle appears on any affected items in the
calculation. Hovering the mouse over a triangle will bring up a tooltip
with either the DVOS error message or a locally generated calculator
message.
The most common error messages in the calculator pertain to the
selecyted timeline. Setting the timeline to Automatic often allows
operations to proceed. Note, however, that any operation (often inside a
black box) that requires specific join handling will require the
timeline and join options to be set explicitly.
Tips/FAQ
- Timeline problems in the calculator often occur if the timeline
is from a previous calculation that has time tags or interval different
from the interval covered by the input data.
- In the calculator it can be useful to save intermediate objects to
the working list and browse them (double click WL object) to see
errors. This can help when a calculation stops for an unknown reason.
Page created by Tony Allen,
Last up-dated: October 2016 Tony Allen