simplify error handling for types