simplify error trapping in utils