Refactor exception.py #18