use error object in validation helpers

I think we want to remove this eventually, but it seemed nicer to first have this code in the repo in a form that users can inline.