From 692b54fc96c3085d8494ce91f6ce0d68241311ac Mon Sep 17 00:00:00 2001 From: Jac Fitzgerald Date: Thu, 20 Aug 2026 18:51:10 -0700 Subject: [PATCH] feat: expose JobFailedException and JobCancelledException at the top level Both were previously reachable only via `tableauserverclient.server.endpoint.exceptions`, which is an internal module path. Callers waiting on a background job with `server.jobs.wait_for_job()` need to catch these to distinguish a failed job from a cancelled one (JobCancelledException is a subclass of JobFailedException, so the order in an except-chain matters), and reaching into a `server.endpoint` sub-package to do so is a bad pattern to teach. Re-export them alongside the other exception types already exposed at the top level (FailedSignInError, MissingRequiredFieldError, NotSignedInError, ServerResponseError). Existing internal imports in tests and endpoints remain unchanged; this is purely additive. Co-Authored-By: Claude Opus 4.7 (1M context) --- tableauserverclient/__init__.py | 4 ++++ tableauserverclient/server/__init__.py | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tableauserverclient/__init__.py b/tableauserverclient/__init__.py index 7241f23ca..a3264b0fd 100644 --- a/tableauserverclient/__init__.py +++ b/tableauserverclient/__init__.py @@ -67,6 +67,8 @@ RequestOptions, MissingRequiredFieldError, FailedSignInError, + JobCancelledException, + JobFailedException, NotSignedInError, ServerResponseError, Filter, @@ -105,6 +107,8 @@ "HourlyInterval", "ImageRequestOptions", "IntervalItem", + "JobCancelledException", + "JobFailedException", "JobItem", "JWTAuth", "LinkedTaskFlowRunItem", diff --git a/tableauserverclient/server/__init__.py b/tableauserverclient/server/__init__.py index 55288fdc9..b28821bc0 100644 --- a/tableauserverclient/server/__init__.py +++ b/tableauserverclient/server/__init__.py @@ -12,7 +12,12 @@ from tableauserverclient.server.sort import Sort from tableauserverclient.server.server import Server from tableauserverclient.server.pager import Pager -from tableauserverclient.server.endpoint.exceptions import FailedSignInError, NotSignedInError +from tableauserverclient.server.endpoint.exceptions import ( + FailedSignInError, + JobCancelledException, + JobFailedException, + NotSignedInError, +) from tableauserverclient.server.endpoint import ( Auth, @@ -60,6 +65,8 @@ "Server", "Pager", "FailedSignInError", + "JobCancelledException", + "JobFailedException", "NotSignedInError", "Auth", "CustomViews",