Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics Functions and Looping Raising Exceptions

What if there are more then one error you raised and how do you get the reference from the others error you have raised

When getting the reference to the error message he raised, he uses as .err and .format err to get the reference. but what if you have multiple error messages that you raised then how would you get the reference from there?

3 Answers

Steven Parker
Steven Parker
215,954 Points

As soon as an error is raised, the program flow immediately moves to the corresponding "except" statement, so it's not possible to raise another one before the except block begins.

Ok thanks so you only can raise one error in a try block?

Steven Parker
Steven Parker
215,954 Points

The block might cover several possible raises, but the first one that occurs diverts the program flow immediately.

k thanks