Skip to content

Commit 042809b

Browse files
Merge pull request #130 from mrcool7387/patch-2
Created snippet custom-exception-type.md
2 parents 894c2df + 07dbbdf commit 042809b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: Create Custom Exception Type
3+
description: Create a Custom Exception Type that can be called with raise.
4+
author: mrcool7387
5+
tags: python,error-creation,organisation,utility
6+
---
7+
8+
```py
9+
class ExceptionName(BaseException):
10+
def __init__(message: str):
11+
super().__init__(message)
12+
13+
# Usage
14+
a: int = 1
15+
16+
if a > 0:
17+
raise ExceptionName('Error Message')
18+
```

0 commit comments

Comments
 (0)