Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After creating connection all error messages are no longer outputed #46

Closed
SupertigerDev opened this issue Jan 28, 2019 · 7 comments
Closed
Labels

Comments

@SupertigerDev
Copy link

SupertigerDev commented Jan 28, 2019

After initializing

process.env.REDISCLOUD_URL = config.redisURL;
const redisClient = require('redis-connection')();

the server no long outputs any errors

@SupertigerDev SupertigerDev changed the title i cant debug my program after using this. i cant debug my server after using this. Jan 28, 2019
@SupertigerDev SupertigerDev changed the title i cant debug my server after using this. After creating connection all error messages are no longer outputed Jan 28, 2019
@nelsonic
Copy link
Member

@supertiger1234 are you able to run a set/get request against the Redis store?
(i.e. is the connection to Redis working?)

@SupertigerDev
Copy link
Author

SupertigerDev commented Jan 28, 2019

Yes it is. and I found out, removing this line from redis-connection fixed the problem. Can you please fix it

process.on('uncaughtException', report_error);

@nelsonic
Copy link
Member

@supertiger1234 this is due to Node.js' single thread nature all errors "bubble" up to this point.
We need this line in order to catch uncaught exceptions in the redis-connection.
If your application is is throwing uncaught exceptions you should be dealing with them appropriately.
There is nothing to "fix" here.

@SupertigerDev
Copy link
Author

Well, user errors could occur and when they do, How can I know how to fix em? This IS something to fix.

@nelsonic
Copy link
Member

@supertiger1234 the point is that user errors generated in your application
should be caught by your application; they should never reach the process.on('uncaughtException'

If your application code is not "catching" errors before this process.on('uncaughtException' is hit,
then you are not "handling" the errors appropriately...
Please see: https://www.joyent.com/node-js/production/design/errors

The user errors are not the fault of the redis-connnection module.
Therefore it's definitely not something to "fix" in this node module.
Please improve your own code before claiming that there is something to "fix" in ours.
If you don't want to handle the errors in your application appropriately, consider not using Node.js.

Thank You 🦄 🌈 ✨

@SupertigerDev
Copy link
Author

Thanks for your reply but just to let you know, no other npm package has ever done this but okay, thanks I gusss

@nelsonic
Copy link
Member

@supertiger1234, Trust me, I feel your frustration. 😞
Not only do other NPM packages do this, it's the only way of preventing a Node.js server from "dying". see: https://github.com/Unitech/pm2/lib/ProcessContainer.js#L289 amongst many others.

in-god-we-trust-all-others-bring-data

If you ever want to turn your opinion into a fact by using data, GitHub Search is your friend:
please see: https://github.com/search?q=process.on%28%27uncaughtException%27&type=Code
image

Exception/Error Handling is one of the biggest reasons why I no longer write Node.js Code. 🚫
I would highly recommend you to switch to Elixir while you're still young. dwyl/learn-elixir#102 💧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants