These three lines are pretty weird. Why not use the `if` body for setting `*error`, and deduplicate the `return` statements?