[feedhenry-dev] Weird behavior in fh-mbaas-express

Wei Li weil at redhat.com
Wed Jan 11 15:39:23 UTC 2017


Is it possible that err.code is "0" (string type), rather than 0 (number
type)?

On Wed, Jan 11, 2017 at 3:36 PM, Paolo Haji <phaji at redhat.com> wrote:

> It's definitely weird that the stack trace points to that line since (0 ||
> 500) === 500
>
> On Wed, Jan 11, 2017 at 1:26 PM, Summers Pittman <supittma at redhat.com>
> wrote:
>
>> Hey guys,
>>
>> While I was debugging this stack trace [https://gist.github.com/secon
>> dsun/16088b4212394140b9053a448d7faf63] in Raincatcher I came across this
>> area of code : https://github.com/feedhenry/fh-mbaas-express/blob/master/
>> lib/mbaas.js#L156
>>
>> It looks like when request can't connect to a service, err.code is set to
>> 0.  Since 0 isn't a valid status code the library will crash the
>> application instead of properly returning an error to the application.
>>
>> I tried doing a check for (err.code === 0) and setting values
>> differently, but this block doesn't execute and the error persists.
>>
>> What should the correct way to handle this situation be?
>>
>> Summers
>>
>>
>>
>> _______________________________________________
>> feedhenry-dev mailing list
>> feedhenry-dev at redhat.com
>> https://www.redhat.com/mailman/listinfo/feedhenry-dev
>>
>>
>
> _______________________________________________
> feedhenry-dev mailing list
> feedhenry-dev at redhat.com
> https://www.redhat.com/mailman/listinfo/feedhenry-dev
>
>


-- 
Wei Li
Red Hat email address: wei.li at redhat.com
Senior Software Engineer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/feedhenry-dev/attachments/20170111/bb05aa2e/attachment.htm>


More information about the feedhenry-dev mailing list