Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Trevor McGill
1,409 PointsBummer: twitter.MessageTooLongError: Oh no! Your message was too long (Hello, World!)
Please help me get through this external function challenge with Python! I feel like I'm raising the exception correctly. Now it's just throwing me an assertion error. See below:
try:
tweet(message)
raise MessageTooLongError('Oh no! Your message was too long ({})'.format(message))
except CommunicationError as err:
print('An error occurred attempting to connect to Twitter. Please try again!')
3 Answers
ryan keenan
2,684 Pointshere is what I used
except MessageTooLongError as err:
print("Oh no! your message was too long {}".format(err))
ryan keenan
2,684 PointsDid you use Except before the MessageTooLongError ?
Trevor McGill
1,409 PointsHey Ryan. I tried using except instead of raise, but it also threw me an error when I subbed in the except keyword. Thoughts?
ryan keenan
2,684 PointsIf you could add a link to the challenge we can give you examples of what to do, to do this when you click the get help button there's a link to "How to ask better questions" . It will show you how to do this
Trevor McGill
1,409 PointsTrevor McGill
1,409 PointsThanks, Ryan! I was able to figure it out. My syntax was correct; however, I was inserting the original message by using "format(message)" instead of "format(err)". Appreciate your help!