-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Override INVALID_PARAMETER_VALUE on fetching non-existent job/cluster (…
…#591) ## Changes Port of databricks/databricks-sdk-go#864 to the Python SDK. Most services use RESOURCE_DOES_NOT_EXIST error code with 404 status code to indicate that a resource doesn't exist. However, for legacy reasons, Jobs and Clusters services use INVALID_PARAMETER_VALUE error code with 400 status code instead. This makes tools like Terraform and UCX difficult to maintain, as these services need different error handling logic. However, we can't change these behaviors as customers already depend on the raw HTTP response status & contents. This PR corrects these errors in the SDK itself. SDK users can then do ``` try: w.jobs.get_by_id('abc') except ResourceDoesNotExist: pass ``` just as you would expect from other resources. Updated the README with more information about this as well. ## Tests <!-- How is this tested? Please see the checklist below and also describe any other relevant tests --> - [ ] `make test` run locally - [ ] `make fmt` applied - [ ] relevant integration tests applied
- Loading branch information
Showing
9 changed files
with
162 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. | ||
|
||
from .base import _ErrorOverride | ||
from .platform import * | ||
import re | ||
|
||
|
||
_ALL_OVERRIDES = [ | ||
{{ range .ErrorOverrides -}} | ||
_ErrorOverride( | ||
debug_name="{{.Name}}", | ||
path_regex=re.compile(r'{{.PathRegex}}'), | ||
verb="{{.Verb}}", | ||
status_code_matcher=re.compile(r'{{.StatusCodeMatcher}}'), | ||
error_code_matcher=re.compile(r'{{.ErrorCodeMatcher}}'), | ||
message_matcher=re.compile(r'{{.MessageMatcher}}'), | ||
custom_error={{.OverrideErrorCode.PascalName}}, | ||
), | ||
{{- end }} | ||
] |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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