refactor exception case