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
sdsasdv gdfgfdg
493 PointsIn try and except, Will i always need to know every time that what type of error will cause program to crash?
Examples: except ValueError except TypeError except IndexError
1 Answer
Steven Parker
243,657 PointsYou can also catch generic errors.
If you don't provide an error type to except, it will catch any kind of error. But without knowing what happened, it might be difficult to recover from the error in a way that would allow your program to continue functioning. But this could be useful if the operations covered by the "try" are optional and the results aren't actually required.