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 error message for 'catch' block missing 'try'. #216

Closed
DanielRosenwasser opened this issue Jul 23, 2014 · 0 comments · Fixed by #262
Closed

Better error message for 'catch' block missing 'try'. #216

DanielRosenwasser opened this issue Jul 23, 2014 · 0 comments · Fixed by #262
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@DanielRosenwasser
Copy link
Member

Consider the following source file:

catch (x) {
}

Currently the compiler reports these errors:

(1,2): Declaration or statement expected.
(1,12): ';' expected.                    

And if we merge 57d7cf5, the compiler will report

(1,1): Declaration or statement expected.
(1,11): '=>' expected.                   

We should give better errors for catch blocks missing try blocks.

@DanielRosenwasser DanielRosenwasser self-assigned this Jul 23, 2014
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 1.1 milestone Jul 23, 2014
DanielRosenwasser added a commit that referenced this issue Jul 26, 2014
…ry' block.

Fixes #216.

As a note of this fix, when a 'catch' block is followed by a 'finally' block, only the 'catch' keyword gets an error reported on it.
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant