refactored exceptions in callbacks and added code coverage