Can you replace this pattern with `t.Errorf(...)`?