---
title: exception (StreamingQuery)
description: "StreamingQuery.exception method in PySpark: Returns the StreamingQueryException if the query was terminated by an exception, or None if the query terminated normally."
canonical_url: https://docs.databricks.com/aws/en/pyspark/reference/classes/streamingquery/exception
---

# exception (StreamingQuery)

Returns the `StreamingQueryException` if the query was terminated by an exception, or `None` if the query terminated normally.

## Syntax

```
exception()
```

## Returns

`StreamingQueryException` or `None`
