add error handling around some trait injection