Weird behavior in fh-mbaas-express

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Weird behavior in fh-mbaas-express

supittma
Administrator
Hey guys,


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
[hidden email]
https://www.redhat.com/mailman/listinfo/feedhenry-dev
Reply | Threaded
Open this post in threaded view
|

Re: Weird behavior in fh-mbaas-express

Paolo Haji
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 <[hidden email]> wrote:
Hey guys,


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
[hidden email]
https://www.redhat.com/mailman/listinfo/feedhenry-dev



_______________________________________________
feedhenry-dev mailing list
[hidden email]
https://www.redhat.com/mailman/listinfo/feedhenry-dev
Reply | Threaded
Open this post in threaded view
|

Re: Weird behavior in fh-mbaas-express

Wei Li
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 <[hidden email]> 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 <[hidden email]> wrote:
Hey guys,


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
[hidden email]
https://www.redhat.com/mailman/listinfo/feedhenry-dev



_______________________________________________
feedhenry-dev mailing list
[hidden email]
https://www.redhat.com/mailman/listinfo/feedhenry-dev




--
Wei Li
Red Hat email address: [hidden email]
Senior Software Engineer

_______________________________________________
feedhenry-dev mailing list
[hidden email]
https://www.redhat.com/mailman/listinfo/feedhenry-dev
Reply | Threaded
Open this post in threaded view
|

Re: Weird behavior in fh-mbaas-express

supittma
Administrator


On Wed, Jan 11, 2017 at 10:39 AM, Wei Li <[hidden email]> wrote:
Is it possible that err.code is "0" (string type), rather than 0 (number type)?


That seems to be it.

 
On Wed, Jan 11, 2017 at 3:36 PM, Paolo Haji <[hidden email]> 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 <[hidden email]> wrote:
Hey guys,


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
[hidden email]
https://www.redhat.com/mailman/listinfo/feedhenry-dev



_______________________________________________
feedhenry-dev mailing list
[hidden email]
https://www.redhat.com/mailman/listinfo/feedhenry-dev




--
Wei Li
Red Hat email address: [hidden email]
Senior Software Engineer


_______________________________________________
feedhenry-dev mailing list
[hidden email]
https://www.redhat.com/mailman/listinfo/feedhenry-dev
Reply | Threaded
Open this post in threaded view
|

Re: Weird behavior in fh-mbaas-express

Wei Li
ah, the "beauty" of javascript ;)

On Wed, Jan 11, 2017 at 4:13 PM, Summers Pittman <[hidden email]> wrote:


On Wed, Jan 11, 2017 at 10:39 AM, Wei Li <[hidden email]> wrote:
Is it possible that err.code is "0" (string type), rather than 0 (number type)?


That seems to be it.

 
On Wed, Jan 11, 2017 at 3:36 PM, Paolo Haji <[hidden email]> 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 <[hidden email]> wrote:
Hey guys,


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
[hidden email]
https://www.redhat.com/mailman/listinfo/feedhenry-dev



_______________________________________________
feedhenry-dev mailing list
[hidden email]
https://www.redhat.com/mailman/listinfo/feedhenry-dev




--
Wei Li
Red Hat email address: [hidden email]
Senior Software Engineer




--
Wei Li
Red Hat email address: [hidden email]
Senior Software Engineer

_______________________________________________
feedhenry-dev mailing list
[hidden email]
https://www.redhat.com/mailman/listinfo/feedhenry-dev