# Raising Your Own Exceptions

A function that's handed a value that makes no sense should refuse it with raise and a message that says what was wrong, can name its own kind of error with a small exception class, and raises rather than returning None when carrying on would give a wrong answer.

![Cheat sheet: Raising Your Own Exceptions](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/03a6efd1867b43d684076f5d3faae7d3.webp)

- Category: Python
- Level: Journeyman
- Tags: Built-in Exceptions, Custom Exception (python), None, python, raise
- Author: Gregor Dzierzon
- Updated: November 23, 2026

Source: https://www.ask-codey.com/cheat-sheets/python-exceptions-raising-your-own-cheat-sheet
