replace exception with if
extract
rename
refactor test