From the course: Python Practice: Real-World Coding Challenges

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Solution: The trouble with scribbles

Solution: The trouble with scribbles - Python Tutorial

From the course: Python Practice: Real-World Coding Challenges

Solution: The trouble with scribbles

(upbeat music) - [Instructor] In this challenge, you probably learned that programming isn't all just thrills and fun. We have a lot of different inputs here and a lot of different situations that need to be handled. Raising all of these exceptions for everything that could go wrong is tedious at times, yes, but I hope you'll find that it's absolutely worth it in the end when your code is robust, easy to use, and well-documented. So let's start off with the actual exception classes that I created. I made a TerminalScribeException. And then extending that, I have the InvalidParameter exception. And most of the exceptions that I throw here are going to be InvalidParameter exceptions because there are lots of ways that you can get the parameters wrong. And for fun, I made the error messages red using the term color package. And I find that really just kind of helps them pop. The one place I threw a TerminalScribeException…

Contents