8000 more helpful error message · RekindleInc/twilio-python@cc3e20d · GitHub
[go: up one dir, main page]

Skip to content

Commit cc3e20d

Browse files
author
Doug Black
committed
more helpful error message
1 parent bba64f2 commit cc3e20d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

twilio/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,11 @@ def __init__(self, status, uri, msg="", code=None):
2525
self.code = code
2626

2727
def __str__(self):
28-
return "HTTP ERROR %s: %s \n %s" % (self.status, self.msg, self.uri)
28+
if self.code:
29+
error_message = "HTTP ERROR %s: %s \n\n " \
30+
"Please see: https://api.twilio.com/docs/errors/%s for more information. \n\n" \
31+
"Requested URI: %s" % (self.status, self.msg, str(self.code), self.uri)
32+
else:
33+
error_message = "HTTP ERROR %s: %s \n %s" % (self.status, self.msg, self.uri)
34+
35+
return error_message

0 commit comments

Comments
 (0)
0