Make error handling logic in convert() more explicit.