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 trialSunil Nagavaram
465 Pointshow to except 2 ValueErrors
i am currently doing the masterticket program and when i enter the valueerror as err it shows the correct thing when it is over 100 but if the user enters a string, the middle turns different and not user friendly. help?
1 Answer
Chris Freeman
Treehouse Moderator 68,454 PointsHey Sunil Nagavaram, the issue is the beyond ticket limit error is being raised explicitly with a string argument but the “invalid int” is raised by the system and gets the auto generated error.
This overloading of different error causes onto the same except block makes both cases handled with the same print message style.
One fix would to handle the “over limit” error by simply printing a message without raising an error.
If it’s important to keep the raised error then a nest a second try/except around the inner error.
Post back if you need more help. Good luck!!!