Skip to content

throws keyword for methods and constructors declarations #2249

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

Closed
AAAbramenko opened this issue May 18, 2022 · 2 comments
Closed

throws keyword for methods and constructors declarations #2249

AAAbramenko opened this issue May 18, 2022 · 2 comments
Labels
feature Proposed language feature that solves one or more problems state-duplicate This issue or pull request already exists

Comments

@AAAbramenko
Copy link

AAAbramenko commented May 18, 2022

What is about to introduce throws keyword:

String readDataFromFile(String path) throws IOException, FormatException {
...
}

This will help to indicates that place of method/constructor calling must be wrapped in try-catch block.
You can find same language feature in Java (look spec here and here)..

@AAAbramenko AAAbramenko added the feature Proposed language feature that solves one or more problems label May 18, 2022
@mateusfccp
Copy link
Contributor

Isn't this the same as checked exceptions? If yes, duplicate of #984.

@munificent
Copy link
Member

Yes, what you're looking for is checked exceptions. We have discussed it at length but feel it's not an overall win for users.

@munificent munificent added the state-duplicate This issue or pull request already exists label May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Proposed language feature that solves one or more problems state-duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants