FailOnError
The FailOnError function of the mplreport class will gracefully fail the report with a “This Report Is Unavailable” message and some explanatory text if one or more errors have been returned as part of a data request, such as FetchHistory or GetEvents.
Parameters
Parameter | Type | Default | Meaning |
---|---|---|---|
description | str | None | An optional string value that describes the type of data being requested |
Results
The final report will say 'xxx Data Unavailable: <driver error messages here>', where 'xxx' is the description.
The description is most often used when a report contains multiple queries (such as one for time-series data and one for events) to differentiate which type of source was unavailable.
But it also makes error messages more human-readable, even when used in reports with only a single request.
Return
No Return Value. This function calls sys.exit() to terminate the script.
Usage
If the data is required to generate your report, we suggest calling this function immediately after any call to GetEvents or FetchHistory.