“raise ValueError” What does it mean?

In this article, we will learn about the statement ‘raise ValueError’. We will try to understand what it means and when to use it with the help of examples. Without further ado, let’s begin! What is ValueError? To define ValueError in simple terms, it is an exception that is raised when an incorrect value is … Read more

Python Re-Raise the Same Exception

In this article, we will learn how to reraise an exception after you have caught it. We will be explaining the 2 methods to do it with examples. Without further ado, let’s begin! Exceptions can be re-raised for various reasons such as; Here are 2 ways to do that: Method#1: raise inside the except block … Read more

Python Raising Error With a Custom Message

In this article, we’ll see how to raise an error with a custom message in Python. We’ll learn how to use the ‘raise’ statement and we’ll practice all of this with the help of examples. Raising Exception The ‘raise’ statement allows you to throw/raise any error manually.  For example: Raising Exception with Custom Message We … Read more

Python: Logging Errors to a Text File

In this article, let us see how we can catch exceptions and log them onto a text file. Logging is a tool used in software engineering to track any and all the events that occur when your program runs. It’s like leaving a trail of breadcrumbs. When something goes wrong, we know where to start … Read more

RuntimeError in Python: Everything You Need to Know!

In this article, let us get ourselves up to speed on the RuntimeError exception in Python. In particular, we will try to answer the following questions. A good grasp of all the built-in exceptions in Python is crucial for anyone serious about becoming a Python Craftsman. This article is all about learning about Runtime Exceptions. … Read more

Custom Exception In Python: Everything You Need To Know!

In this article, let us learn all about custom exceptions in Python. In particular, we will try to answer the following questions Let’s begin by addressing what are custom exceptions. What are custom exceptions? In simple words, a “custom exception” a.k.a a “user-defined exception” is an exception that you yourself have defined and designed (as … Read more