Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

### Bug Fixes
- Improving the error message that is shown when the unsupported `dbutils.credentials.getServiceCredentialsProvider` method is used. This method can only be used inside of a notebook.
- Return error message when body doesn't support `len()` while logging error.

### Documentation

Expand Down
8 changes: 6 additions & 2 deletions databricks/sdk/logger/round_trip_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,12 @@ def _recursive_marshal(self, v: Any, budget: int) -> Any:
return v

def _redacted_dump(self, prefix: str, body: str) -> str:
if len(body) == 0:
return ""
try:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should check isinstance(body, str) instead of try catch

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also could we try str(body)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, I think isinstance would be better.

if len(body) == 0:
return ""
except TypeError:
return "unsupported body type"

try:
# Unmarshal body into primitive types.
tmp = json.loads(body)
Expand Down
Loading