transform should return err, res