catch throw refactor