code: def exception(self):
          
          if self._jsq.exception().isDefined():
              je = self._jsq.exception().get()
              msg = je.toString().split(': ', 1)[1]  # Drop the Java StreamingQueryException type info
              stackTrace = '\n\t at '.join(map(lambda x: x.toString(), je.getStackTrace()))
              return StreamingQueryException(msg, stackTrace, je.getCause())
          else:
              return None
docs: :return: the StreamingQueryException if the query was terminated by an exception, or None.