Closed Bug 1618039 Opened 6 years ago Closed 6 years ago

try/catch accepts non-standard catch format

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: mark, Unassigned)

Details

Firefox seems to accept non-standard catch conditions in try/catch blocks.

According to the documentation, try/catch must always have a catch or finally statement, where the catch statement must always include an error object as a passed variable:

try {
  do something
} 
catch (error) {
  do something with error (or not)
}

However, it accepts catch without (error) too:

try {
  do something
} 
catch {
}

That seems wrong and non-standard to me?

No it's part of ECMAScript 2019. This blog post explains it a bit.

Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INVALID

Can you please point me to the BZ bug then where you changed it so I can look at porting it? I haven't been able to find anything relevant before I posted this.

(Of note I find it a terrible change in ECMAScript allowing for this kind of further blurring syntax and setting up even more feature than can allow things to silently fail and make a terrible mess of debugging.)

You need to log in before you can comment on or make changes to this bug.