Avoid abuse of return variables.

Introduce github.com/juju/errors.
Fix worker tests wrt sqlx API changes.