Skip to content
Open
Changes from all 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
10 changes: 4 additions & 6 deletions src/datadog_api_client/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,12 @@ def __init__(self, status=None, reason=None, http_resp=None):

def __str__(self):
"""Custom error messages for exception"""
error_message = "({0})\n" "Reason: {1}\n".format(self.status, self.reason)
parts = [f"({self.status})\nReason: {self.reason}\n"]
if self.headers:
error_message += "HTTP response headers: {0}\n".format(self.headers)

parts.append(f"HTTP response headers: {self.headers}\n")
if self.body:
error_message += "HTTP response body: {0}\n".format(self.body)

return error_message
parts.append(f"HTTP response body: {self.body}\n")
return ''.join(parts)


class NotFoundException(ApiException):
Expand Down