Handle error with exception for unit converter