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

How To Make Raised Exceptions Look "Clean" When Getting ValueErrors In VSCode

I have a pretty solid function I created to determine a "parabolic age" which actually means nothing.

I made it in VSCode, however I have it laid out in a way that seems to be identical to the way it is in this video as far as the try block, except block and else block.

However, no matter what I do, I can't get a "clean" error message like Craig does at the end of this video.

I get the error: "Traceback (most recent call last): File "parabolic_age_function.py", line 13, in <module> print(divide_and_multiply(parabolic_age)) File "parabolic_age_function.py", line 5, in divide_and_multiply raise ValueError ("parabolic age not allowed to be below 10, try again") ValueError: parabolic age not allowed to be below 10, try again"

I'm more than willing to throw it up on GitHub to get some help with this.


1 Answer

Jeff Muday
Jeff Muday
Treehouse Moderator 27,510 Points

I'd be happy to take a look at the code for you. You can share it from a workspace snapshot or GitHub link.