state/api: use juju/errors