exception handling with conditionals