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

Handle callback errors #4951

Merged
merged 1 commit into from Aug 17, 2016
Merged

Handle callback errors #4951

merged 1 commit into from Aug 17, 2016

Conversation

lo1tuma
Copy link
Contributor

@lo1tuma lo1tuma commented Aug 16, 2016

While debugging a failing test I’ve noticed that there was an unhandled callback error in the failing test. I spent a lot of time to figure out why the assertion was failing, but the data, used in the assertion, was not present at all due to a previous error.

I’ve added eslint and enabled to rule handle-callback-err which can detect some unhandled errors statically. ESLint found round about 100 unhandled errors in the whole project.

I tried to fix this and handle all errors properly. In some cases I was not sure if an error was ignored intentionally. So please review these changes carefully and let me know if there is such an case where the error should be ignored. Nevertheless, even if an error should be ignored I think we should at least log the error with winston.

@CLAassistant
Copy link

CLAassistant commented Aug 16, 2016

CLA assistant check
All committers have signed the CLA.

@lo1tuma
Copy link
Contributor Author

lo1tuma commented Aug 16, 2016

The linting process is failing on travis for node versions < 4. ESLint requires at least node version 4, as it uses some ES2015 features.

@barisusakli
Copy link
Member

Can you make the eslint addition a separate PR so we can merge the callback additions?

Also you can just use winston.error(err);

var db = require('./src/database');

db.getSortedSetRange('plugins:active', 0, -1, function(err, plugins) {
if (err) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation is off here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@lo1tuma
Copy link
Contributor Author

lo1tuma commented Aug 17, 2016

@barisusakli Thanks for the code review. I addressed most of the concerns you mentioned, except for one, where I posted a follow-up question.

Apart from that, I also removed the ESLint part from this PR. I will create a separate PR for this 😉.

@barisusakli barisusakli added this to the 1.2.0 milestone Aug 17, 2016
@barisusakli barisusakli self-assigned this Aug 17, 2016
@barisusakli barisusakli merged commit dfaa27b into NodeBB:master Aug 17, 2016
@lo1tuma lo1tuma deleted the handle-errors branch August 17, 2016 11:18
BenLubar added a commit to boomzillawtf/tdwtf that referenced this pull request Aug 20, 2016
- Resolve two DoS attack vectors <NodeBB/NodeBB#4949>
- Fix the thing that caused 502s last time there was an update <NodeBB/NodeBB@3161879>
- Admins can now attack the tag cloud <NodeBB/NodeBB#4795>
- Logging in/out with multiple tabs open is less buggy <NodeBB/NodeBB#4950>
- Fixed the timestamp not being set on replies <NodeBB/NodeBB@3b0eca3>
- Fixed unnecessary page refresh when going to replied-to posts <NodeBB/NodeBB@9207d6a>
- Purged topics are removed from the followed topics set <NodeBB/NodeBB#4955>
- Fixed a bunch of unhandled errors <NodeBB/NodeBB#4951>
- Fixed breadcrumb for account info page <NodeBB/NodeBB#4958>
- Moved login session list to the account info page <NodeBB/NodeBB#4959> <NodeBB/nodebb-theme-persona#310>
- Got rid of error messages about malformed URLs in the server log <NodeBB/NodeBB#4954>
- **HEY GUYS they fixed "new posts made to topic" notifications going to the end of the topic** <NodeBB/NodeBB#4469>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants