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

Better document what happens when you don't specify catch #12

Closed
Flimm opened this issue Nov 6, 2013 · 2 comments
Closed

Better document what happens when you don't specify catch #12

Flimm opened this issue Nov 6, 2013 · 2 comments

Comments

@Flimm
Copy link

Flimm commented Nov 6, 2013

In Java, Python and Javascript, if you do not specify a catch block, the exception is thrown (after executing a final block).

In contrast, when the catch block is ommitted, Try::Tiny will simply behave as if you specified an empty catch block, and will suppress the exception.

I'm not asking for this behaviour to change. I'm just asking that this behaviour be better documented, as I read the documentation and yet this behaviour still surprised me. For example, including a paragraph like this would be very helpful to people like me:

Try::Tiny's try/catch/finally construct behaves very similarly to equivalent constructs in other programming languages, such as Java, Javascript and Python. One difference may surprise you, however: Try::Tiny will treat an unspecified catch block as an empty catch block, suppressing the exception, unlike other languages which will rethrow the exception. You have been warned!

@doy
Copy link
Owner

doy commented Feb 25, 2014

Can you submit a pull request for this? One thing that would be worth noting is that while it is different from the behavior in languages like Java, it does follow the same behavior as eval in Perl.

@Flimm
Copy link
Author

Flimm commented Mar 7, 2014

Here's a pull request. #15

@doy doy closed this as completed Mar 21, 2014
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