Skip to content

Commit 8812096

Browse files
Remove unnecessary warnings
1 parent ad0e9f1 commit 8812096

File tree

1 file changed

+9
-30
lines changed

1 file changed

+9
-30
lines changed

databricks/sdk/errors/base.py

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -62,31 +62,6 @@ def __init__(
6262
:param details:
6363
:param kwargs:
6464
"""
65-
# SCIM-specific parameters are deprecated.
66-
if detail:
67-
warnings.warn(
68-
"The 'detail' parameter of DatabricksError is deprecated and will be removed in a future version."
69-
)
70-
if scimType:
71-
warnings.warn(
72-
"The 'scimType' parameter of DatabricksError is deprecated and will be removed in a future version."
73-
)
74-
if status:
75-
warnings.warn(
76-
"The 'status' parameter of DatabricksError is deprecated and will be removed in a future version."
77-
)
78-
79-
# API 1.2-specific parameters are deprecated.
80-
if error:
81-
warnings.warn(
82-
"The 'error' parameter of DatabricksError is deprecated and will be removed in a future version."
83-
)
84-
85-
# Retry-after is deprecated.
86-
if retry_after_secs:
87-
warnings.warn(
88-
"The 'retry_after_secs' parameter of DatabricksError is deprecated and will be removed in a future version."
89-
)
9065

9166
if detail:
9267
# Handle SCIM error message details
@@ -101,7 +76,7 @@ def __init__(
10176

10277
super().__init__(message if message else error)
10378
self.error_code = error_code
104-
self.retry_after_secs = retry_after_secs
79+
self._retry_after_secs = retry_after_secs
10580
self._error_details = errdetails.parse_error_details(details or [])
10681
self.kwargs = kwargs
10782

@@ -113,13 +88,17 @@ def __init__(
11388
continue
11489
self.details.append(ErrorDetail.from_dict(d))
11590

116-
def get_error_info(self) -> List[ErrorDetail]:
117-
return self._get_details_by_type(errdetails._ERROR_INFO_TYPE)
91+
@property
92+
def retry_after_secs(self) -> Optional[int]:
93+
warnings.warn(
94+
"The 'retry_after_secs' parameter of DatabricksError is deprecated and will be removed in a future version."
95+
)
96+
return self._retry_after_secs
11897

119-
def _get_details_by_type(self, error_type) -> List[ErrorDetail]:
98+
def get_error_info(self) -> List[ErrorDetail]:
12099
if self.details is None:
121100
return []
122-
return [detail for detail in self.details if detail.type == error_type]
101+
return [detail for detail in self.details if detail.type == errdetails._ERROR_INFO_TYPE]
123102

124103
def get_error_details(self) -> errdetails.ErrorDetails:
125104
return self._error_details

0 commit comments

Comments
 (0)