Improve exception handling in logic.py
Improve exception handling in logic.py

Previously the code assumed that every backend imports exceptions.py as e.
However, some implementations may chose a different import style or may
not require importing the module at all.

DaKnOb/TorPaste,DaKnOb/TorPaste