docstr: Display an exception chain with its tracebacks and call stack.
          
docstr_tok: ["Display","an","exception","chain","with","its","tracebacks","and","call","stack","."]
code: def setException(self, exc=None, lastFrame=None):
      """Display an exception chain with its tracebacks and call stack."""
      if exc is None:
          exc = sys.exc_info()[1]
  
      self.clear()
  
      exceptions = exceptionChain(exc)
      for ex, cause in exceptions:
          stackFrames, tbFrames = stacksFromTraceback(
              ex.__traceback__, lastFrame=lastFrame
          )
          catchMsg = textItem("Exception caught here")
          excStr = "".join(
              traceback.format_exception_only(type(ex), ex)
          ).strip()
          items = makeItemTree(
              stackFrames + [catchMsg] + tbFrames, excStr
          )
          self.addTopLevelItem(items[0])
          if cause is not None:
              if cause == "cause":
                  causeItem = textItem(
                      "The above exception was the direct cause of the following exception:"
                  )
              elif cause == "context":
                  causeItem = textItem(
                      "During handling of the above exception, another exception occurred:"
                  )
              self.addTopLevelItem(causeItem)
  
      items[0].setExpanded(True)
  
file_path: pyqtgraph/pyqtgraph/console/stackwidget.py
imports: import sys, traceback
  from ..Qt import QtWidgets, QtGui
label_desc: Use image node_id 4 for calling the StackWidget obj's underlying member method code with example usage: obj.setException(exc, lastFrame) without return types