-
Notifications
You must be signed in to change notification settings - Fork 0
/
myexceptions.py
executable file
·42 lines (34 loc) · 1.23 KB
/
myexceptions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# -*- coding: utf-8 -*-
#title: myexceptions.py
#description: Storage for my basic exceptiopns
#author: Ricky Laney
#date: 20190125
#version: 0.0.1
#usage: python -m myexceptions.py or import myexceptions.py
#notes:
#python_version: 3.7.0
#==============================================================================
class Error(Exception):
"""Base class for exceptions in this module."""
pass
class InputError(Error):
"""Exception raised for errors in the input.
Attributes:
expression -- input expression in which the error occurred
message -- explanation of the error
"""
def __init__(self, expression, message):
self.expression = expression
self.message = message
class TransitionError(Error):
"""Raised when an operation attempts a state transition that's not
allowed.
Attributes:
previous -- state at beginning of transition
next -- attempted new state
message -- explanation of why the specific transition is not allowed
"""
def __init__(self, previous, next, message):
self.previous = previous
self.next = next
self.message = message