next up previous contents index
Next: Generic Handle Functions Up: Main Functions 2 Previous: Bitwise Logic   Contents   Index

Error Reporting

The following functions provide an interface to the Xic error reporting and logging system. The first two functions operate on the ``message'' which is a list of strings generated by errors encountered in function calls. Within Xic, the message may or may not be added to the error log, which is accessible via the functions below. Logged messages are included in the error log file, and will be displayed in a pop-up on-screen. If not added to the error log, the message may be displayed in another type of pop-up window, or on the prompt line, or may be placed in a conversion log file.

(string) GetError()
This returns the current error text. Error messages generated by an unsuccessful operation that opens, translates, or writes cells or manipulates the database, can be retrieved with this function for diagnostic purposes. This function should be called immediately after an error return is detected, since subsequent operations may clear or change the error text. If there are no recorded errors, a ``no errors'' string is returned. This function never fails and always returns a message string.

AddError(string)
This function will add a string to the current error message, which can be retrieved with GetError. This is useful for error reporting from user-defined functions. Any number of calls can be made, with the retrieved text consisting of a concatenation of the strings, with line termination added if necessary, in reverse order of the AddError calls. No other built-in function should be executed between calls to AddError, or between a call that generated an error and a call to AddError, as this will cause the second string to overwrite the first.

(int) GetLogNumber()
Return the integer index of the most recent error message dumped to the errors log file. The return value is 0 if there are no errors recorded in the file.

(string) GetLogMessage(message_num)
Return the error message string corresponding to the integer argument, as was appended to the errors log file. The 10 most recent error messages are available. If the argument is out of range, a null string is returned. The range is the current index to (not including) this index minus 10, or 0, whichever is larger.

(int) AddLogMessage(string, error)
Apply a new message to the error/warning log file. The second argument is a boolean which if nonzero will add the string as an error message, otherwise the message is added as a warning. The return value is the index assigned to the new message, or 0 if the string is empty or null.


next up previous contents index
Next: Generic Handle Functions Up: Main Functions 2 Previous: Bitwise Logic   Contents   Index
Stephen R. Whiteley 2017-03-22