You can try something like this to include more information in any exceptions occurring in your PythonCallers:
import fmeobjects
import traceback
class FeatureProcessor(object):
"""Template Class Interface:
When using this class, make sure its name is set as the value of the 'Class
to Process Features' transformer parameter.
"""
def __init__(self):
"""Base constructor for class members."""
self.feature_count = 0
self.log = fmeobjects.FMELogFile()
def _log(self, message, severity=fmeobjects.FME_INFORM):
"""
Sends message to the FME log file and console window.
Severity must be one of FME_INFORM, FME_WARN, FME_ERROR,
FME_FATAL, FME_STATISTIC, or FME_STATUSREPORT.
"""
self.log.logMessageString(message, severity)
def input(self, feature):
"""This method is called for each FME Feature entering the
PythonCaller. If knowledge of all input Features is not required for
processing, then the processed Feature can be emitted from this method
through self.pyoutput(). Otherwise, the input FME Feature should be
cached to a list class member and processed in process_group() when
'Group by' attributes(s) are specified, or the close() method.
:param fmeobjects.FMEFeature feature: FME Feature entering the
transformer.
"""
try:
self.feature_count += 1
self.pyoutput(feature)
except:
self._log('='*78, fmeobjects.FME_ERROR)
message = "{}({}) exception at feature number {}:".format(
self.factory_name, self.__class__.__name__, self.feature_count)
self._log(message, fmeobjects.FME_ERROR)
self._log('-'*78, fmeobjects.FME_ERROR)
for line in traceback.format_exc().splitlines():
self._log(line, fmeobjects.FME_ERROR)
self._log('='*78, fmeobjects.FME_ERROR)
if feature:
self.log.logFeature(feature, fmeobjects.FME_ERROR)
message = "An error occurred in {} method '{}'. See log for details.".format(
self.factory_name, self.__class__.__name__)
raise fmeobjects.FMEException(message)
As you can see, it uses the traceback module from the Python standard library to dump the entire stack trace with line numbers if an exception occurrs, then terminates your workspace.