def exception(self): """ :return: the StreamingQueryException if the query was terminated by an exception, or None. """ 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) else: return None
def exception(self) -> Optional[StreamingQueryException]: """ .. versionadded:: 2.1.0 Returns ------- :class:`StreamingQueryException` the StreamingQueryException if the query was terminated by an exception, or None. """ 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