refactoring: use exception object in loggging