Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tc39/proposal-optional-catch-binding
proposal for ECMAScript to allow omission of the catch binding
https://github.com/tc39/proposal-optional-catch-binding
Last synced: about 2 months ago
JSON representation
proposal for ECMAScript to allow omission of the catch binding
- Host: GitHub
- URL: https://github.com/tc39/proposal-optional-catch-binding
- Owner: tc39
- Archived: true
- Created: 2017-06-11T05:14:37.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-22T18:40:00.000Z (over 6 years ago)
- Last Synced: 2024-06-04T15:42:41.117Z (4 months ago)
- Language: HTML
- Homepage: https://tc39.github.io/proposal-optional-catch-binding/
- Size: 18.6 KB
- Stars: 86
- Watchers: 16
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This proposal makes a grammatical change to ECMAScript, allowing the omission
of a `catch` binding in cases where the binding would not be used. This occurs
frequently with patterns such as```js
try {
// try to use a web feature which may not be implemented
} catch (unused) {
// fall back to a less desirable web feature with broader support
}
```or
```js
let isTheFeatureImplemented = false;
try {
// stress the required bits of the web API
isTheFeatureImplemented = true;
} catch (unused) {}
```or
```js
let parseResult = someFallbackValue;
try {
parseResult = JSON.parse(potentiallyMalformedJSON);
} catch (unused) {}
```and it is a common opinion that variables which are declared or written to but
never read signify a programming error.The grammar change introduced by this proposal allows for the `catch` binding
and its surrounding parentheses to be omitted, as in```js
try {
// ...
} catch {
// ...
}
```See [the the full text of the proposal](https://tc39.github.io/proposal-optional-catch-binding/) for more info.