Ok, sounds good.  This is arguably some of the most dangerous bits of code,
so it's good to discuss and review.

-bewest


On Thu, Jan 30, 2014 at 4:02 PM, cheddar <notifications@github.com> wrote:

> In lib/middleware.js:
>
> > +
> > +    getMetaPair: function(req, res, next) {
> > +      // if our token is a user token, we can only return that user's information
> > +      var userid = req._tokendata.userid;
> > +      // but if it's a server token, then use the userid specified
> > +      if (req._tokendata.isserver) {
> > +        userid = req.params.userid;
> > +      }
> > +
> > +      client.getMetaPair(userid, function(err, pair) {
> > +        if (err) {
> > +          if (err.statusCode != null) {
> > +            res.send(err.statusCode);
> > +            return next(false);
> > +          }
> > +          else {
>
> This else happens when actual communication errors occur. errors with a
> statuscode are errors created by the client library and they are
> intentionally trying to communicate something back up to the user. errors
> without a status code are unforeseen issues, like connection problems,
> which are server problems. We should perhaps add a log line here to log the
> error, but I think this is communicating exactly what we want it to
> communicate.
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/tidepool-org/user-api-client/pull/2/files#r9329622>
> .
>