refactor
fix try-catch and throw