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

always-catch: Consider two param then as the same as catch #4

Closed
feross opened this issue Feb 5, 2016 · 9 comments
Closed

always-catch: Consider two param then as the same as catch #4

feross opened this issue Feb 5, 2016 · 9 comments

Comments

@feross
Copy link
Contributor

feross commented Feb 5, 2016

For the always-catch rule, I'd like to be able to consider this:

myPromise.then(doSomething, catchErrors);

as a valid catch, since lots of code that uses standard does that.

@xjamundx
Copy link
Contributor

@feross Yeah catch is maybe slightly better, because it will also catch programmer errors in the doSomething code, but it's certainly better than nothing. Maybe I can add an exception or something. Thanks for the idea. Will mull it over a bit.

@feross
Copy link
Contributor Author

feross commented Feb 23, 2016

Yep, I understand. I just couldn't enable this rule without causing tons of standard users' code to fail. If there's a way to just check that there's any catch handler in then() or catch(), that would be a good candidate to enable for all standard users.

@xjamundx
Copy link
Contributor

I'll add a configurable exception "always-catch": [2, { allowThen: true }]. Think that might work?

@feross
Copy link
Contributor Author

feross commented Feb 23, 2016

@xjamundx Yep, that'd work.

@xjamundx
Copy link
Contributor

K give me a week if it don't forget !

On Tue, Feb 23, 2016 at 1:07 PM, Feross Aboukhadijeh <
notifications@github.com> wrote:

@xjamundx https://github.com/xjamundx Yep, that'd work.


Reply to this email directly or view it on GitHub
#4 (comment)
.

@xjamundx
Copy link
Contributor

A lot of people are also saying if the promise is returned it doesn't need
to be caught. I may also add this exception

On Tue, Feb 23, 2016 at 1:07 PM, Jamund Ferguson jamund@gmail.com wrote:

K give me a week if it don't forget !

On Tue, Feb 23, 2016 at 1:07 PM, Feross Aboukhadijeh <
notifications@github.com> wrote:

@xjamundx https://github.com/xjamundx Yep, that'd work.


Reply to this email directly or view it on GitHub
#4 (comment)
.

@xjamundx
Copy link
Contributor

xjamundx commented Mar 2, 2016

Started on this

@xjamundx
Copy link
Contributor

xjamundx commented Mar 2, 2016

Closed by 41f1c02

@xjamundx xjamundx closed this as completed Mar 2, 2016
@feross
Copy link
Contributor Author

feross commented Mar 16, 2016

Nice, will try to release this in standard v7!

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

No branches or pull requests

2 participants