feat: expose JobFailedException and JobCancelledException at TSC top level - #1870
Open
jacalata wants to merge 1 commit into
Open
feat: expose JobFailedException and JobCancelledException at TSC top level#1870jacalata wants to merge 1 commit into
jacalata wants to merge 1 commit into
Conversation
…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) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Both
JobFailedExceptionandJobCancelledExceptionare currently reachable only viatableauserverclient.server.endpoint.exceptions— an internal module path. Callers waiting on a background job withserver.jobs.wait_for_job()need to catch these to distinguish a failed job from a cancelled one, and reaching into aserver.endpointsub-package is a bad pattern to teach.Behavior change
TSC.JobFailedExceptionandTSC.JobCancelledExceptionare now importable from the top level, alongsideFailedSignInError,MissingRequiredFieldError,NotSignedInError, andServerResponseError.JobCancelledExceptionremains a subclass ofJobFailedException, so anexcept JobFailedExceptionstill catches both. New code that wants to differentiate should catchJobCancelledExceptionfirst.Test plan
python -c "import tableauserverclient as TSC; assert issubclass(TSC.JobCancelledException, TSC.JobFailedException)"— passes.'JobFailedException' in TSC.__all__and'JobCancelledException' in TSC.__all__— both true.Followup
samples/list_jobs.py(added in #1843) currently reaches into the internal path. Once #1843 merges, a one-line followup PR will switch it to the top-level import.