Returns the last error occurred when calling a plug-in function other than itself.
PyLastError( "--with-traceback" )
The function may be called without arguments; in this case you may omit the usual parentheses..
--with-traceback
keyword, case-insensitive, filtered.Specifies that you want to get the last error with the Python traceback, if any.
When called without parameters, the function returns a string that describes the error in the last called PyFM function other than PyLastError. If that function didn't result in an error, the result will be empty.
The error message uses the default Python format, for example:
Exception: something wrong.
Usually the message is single-line, but some messages (e.g. Python syntax errors) may be multi-line.
When called with the --with-traceback
parameter the function returns the
error string preceded by the standard Python traceback.
PyLastError itself doesn't change the last error state and is as lean as possible, so it can be called as often as necessary. It is safe to put it onto the ‘Watch’ tab in FileMaker Pro Advanced Data Viewer.
Example call:
PyLastError
If the last called PyFM function had no errors, this will return an empty string. If the last function attempted to divide by zero, the result will be:
ZeroDivisionError: integer division or modulo by zero
Example call:
PyLastError( "--with-traceback" )
Again, if the last called PyFM function had no errors, the call will return an empty string. If the last function attempted to divide by zero the result may be like that:
Traceback (most recent call last): File "plugin/lab.pyc", line 24, in PyLab File "plugin/lab.pyc", line 46, in run File "C:\Users\mikhail\Documents\PyFM\hello.py", line 14, in test return 1 / 0 ZeroDivisionError: integer division or modulo by zero
The traceback shows that the error occurred in file hello.py
, line 14,
function test
; the next line shows the source line. The preceding lines
list two functions of the built-in plugin.lab
module that implement the
PyLab
functions that was used to call the code.