refactoring exception classes + unittest the exceptions