diff --git a/changes/issue3306.yaml b/changes/issue3306.yaml new file mode 100644 index 000000000000..86c4c85a68bc --- /dev/null +++ b/changes/issue3306.yaml @@ -0,0 +1,5 @@ +enhancement: + - "Use explicit exception chaining [#3306](https://github.com/PrefectHQ/prefect/issues/3306)" + +contributor: + - "[Abid Ahmad](https://github.com/abid1998)" \ No newline at end of file diff --git a/src/prefect/environments/execution/k8s/job.py b/src/prefect/environments/execution/k8s/job.py index 6cfbb0d0210e..254eba6b4632 100644 --- a/src/prefect/environments/execution/k8s/job.py +++ b/src/prefect/environments/execution/k8s/job.py @@ -128,9 +128,11 @@ def execute(self, flow: "Flow", **kwargs: Any) -> None: # type: ignore # Verify environment is running in cluster try: config.load_incluster_config() - except config.config_exception.ConfigException: + except config.config_exception.ConfigException as err: self.logger.error("Environment not currently running inside a cluster") - raise EnvironmentError("Environment not currently inside a cluster") + raise EnvironmentError( + "Environment not currently inside a cluster" + ) from err batch_client = client.BatchV1Api()