Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't show server response in truss push errors #721

Merged
merged 2 commits into from
Nov 8, 2023
Merged
Changes from 1 commit
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
14 changes: 1 addition & 13 deletions truss/remote/baseten/error.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import json


class Error(Exception):
"""Base Baseten Error"""

Expand All @@ -17,16 +14,7 @@ def __init__(self, message, response=None):
self.response = response

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you can remove all of this response stuff now and we can just pass for the whole class

def __str__(self):
error_str = self.message
if (
self.response is not None
): # non-200 Response objects are falsy, hence the not None.
error_message = json.loads(self.response.content)
error_message = (
error_message["error"] if "error" in error_message else error_message
)
error_str = f"{error_str}\n<Server response: {error_message}>"
return error_str
return self.message


class AuthorizationError(Error):
Expand Down
Loading