def logException():
    out = cStringIO.StringIO()
    ErrorHandler.logError(out)
    
    errorTags = [frame.executable.dt._error_tag
                 for frame in Component.componentStack
                 if isinstance(frame.executable, Executables.STMLExecutable)
                 if hasattr(frame.executable.dt, '_error_tag')]
    if errorTags:
        out.write('Tag traceback (most recent tag last):\n')
        for tag in errorTags:
            if tag:
                out.write('  File "%s", line %s\n' % (tag._name, tag._lineno))
                out.write('    %s\n' % tag.tag)
            else:
                out.write('  File ??, line??\n')

    x = out.getvalue()
    Logs.ERROR(x)
    return x
def logException():
    out = cStringIO.StringIO()
    ErrorHandler.logError(out)

    errorTags = [
        frame.executable.dt._error_tag for frame in Component.componentStack
        if isinstance(frame.executable, Executables.STMLExecutable)
        if hasattr(frame.executable.dt, '_error_tag')
    ]
    if errorTags:
        out.write('Tag traceback (most recent tag last):\n')
        for tag in errorTags:
            if tag:
                out.write('  File "%s", line %s\n' % (tag._name, tag._lineno))
                out.write('    %s\n' % tag.tag)
            else:
                out.write('  File ??, line??\n')

    x = out.getvalue()
    Logs.ERROR(x)
    return x