Skip to content

Commit 15940f2

Browse files
committed
minor fix in error message
1 parent d3b85cb commit 15940f2

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

databricks/sdk/errors/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def _unknown_error(response: requests.Response) -> str:
3838
return (
3939
'This is likely a bug in the Databricks SDK for Python or the underlying '
4040
'API. Please report this issue with the following debugging information to the SDK issue tracker at '
41-
f'https://github.com/databricks/databricks-sdk-go/issues. Request log:```{request_log}```')
41+
f'https://github.com/databricks/databricks-sdk-py/issues. Request log:```{request_log}```')
4242

4343

4444
class _Parser:

tests/test_errors.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ def make_private_link_response() -> requests.Response:
8282
subclass_test_cases = [(fake_valid_response('GET', x[0], x[1], 'nope'), x[2], 'nope')
8383
for x in base_subclass_test_cases]
8484

85+
UNABLE_TO_PARSE_RESPONSE_ERROR = (
86+
'unable to parse response. This is likely a bug in the Databricks SDK for Python or the underlying API. '
87+
'Please report this issue with the following debugging information to the SDK issue tracker at '
88+
'https://github.com/databricks/databricks-sdk-py/issues. Request log:```GET /api/2.0/service\n'
89+
'< {status_code} {reason}\n< {response_body}```')
90+
8591

8692
@pytest.mark.parametrize(
8793
'response, expected_error, expected_message', subclass_test_cases +
@@ -112,11 +118,8 @@ def make_private_link_response() -> requests.Response:
112118
(fake_response('GET', 400, '<pre>Worker environment not ready</pre>'), errors.BadRequest,
113119
'Worker environment not ready'),
114120
(fake_response('GET', 400, 'this is not a real response'), errors.BadRequest,
115-
('unable to parse response. This is likely a bug in the Databricks SDK for Python or the underlying API. '
116-
'Please report this issue with the following debugging information to the SDK issue tracker at '
117-
'https://github.com/databricks/databricks-sdk-go/issues. Request log:```GET /api/2.0/service\n'
118-
'< 400 Bad Request\n'
119-
'< this is not a real response```')),
121+
UNABLE_TO_PARSE_RESPONSE_ERROR.format(
122+
status_code=400, reason='Bad Request', response_body='this is not a real response')),
120123
(fake_response(
121124
'GET', 404,
122125
json.dumps({
@@ -125,11 +128,10 @@ def make_private_link_response() -> requests.Response:
125128
'schemas': ['urn:ietf:params:scim:api:messages:2.0:Error']
126129
})), errors.NotFound, 'None Group with id 1234 is not found'),
127130
(fake_response('GET', 404, json.dumps("This is JSON but not a dictionary")), errors.NotFound,
128-
'unable to parse response. This is likely a bug in the Databricks SDK for Python or the underlying API. Please report this issue with the following debugging information to the SDK issue tracker at https://github.com/databricks/databricks-sdk-go/issues. Request log:```GET /api/2.0/service\n< 404 Not Found\n< "This is JSON but not a dictionary"```'
129-
),
131+
UNABLE_TO_PARSE_RESPONSE_ERROR.format(
132+
status_code=404, reason='Not Found', response_body='"This is JSON but not a dictionary"')),
130133
(fake_raw_response('GET', 404, b'\x80'), errors.NotFound,
131-
'unable to parse response. This is likely a bug in the Databricks SDK for Python or the underlying API. Please report this issue with the following debugging information to the SDK issue tracker at https://github.com/databricks/databricks-sdk-go/issues. Request log:```GET /api/2.0/service\n< 404 Not Found\n< �```'
132-
)])
134+
UNABLE_TO_PARSE_RESPONSE_ERROR.format(status_code=404, reason='Not Found', response_body='�'))])
133135
def test_get_api_error(response, expected_error, expected_message):
134136
parser = errors._Parser()
135137
with pytest.raises(errors.DatabricksError) as e:

0 commit comments

Comments
 (0)