Skip to content

dont throw errors#13

Open
kguirguis wants to merge 2 commits into
reedog117:masterfrom
kguirguis:fix_errors
Open

dont throw errors#13
kguirguis wants to merge 2 commits into
reedog117:masterfrom
kguirguis:fix_errors

Conversation

@kguirguis

Copy link
Copy Markdown

No description provided.

@reedog117

Copy link
Copy Markdown
Owner

I haven't had time to maintain this module -- why no longer throw errors? Just trying to understand rationale before merging everything in.

@kguirguis

Copy link
Copy Markdown
Author

The reason I was getting rid of throwing errors, was since it's asynchronous, once the error is thrown, we would not be able to catch it, since the block of code would've already 'executed'; so by removing the throwing of errors, we could just listen to the event 'error' and should be able to handle that.

For example:

try {
var c = new Client(CREDS_TO_THROW_ERROR);
} catch (e) { // would not catch the error since the block would've completed before the error is thrown; and the error would exit the node process.
console.log(e);
}

Thanks a lot for the response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants