mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
Fix #4137: Caught errors named undefined
Previously, `catch`-less `try`s named the caught error `undefined`, instead of `error` like usual.
This commit is contained in:
@@ -1931,6 +1931,7 @@ exports.Try = class Try extends Base
|
||||
[].concat @makeCode(" catch ("), placeholder.compileToFragments(o), @makeCode(") {\n"),
|
||||
@recovery.compileToFragments(o, LEVEL_TOP), @makeCode("\n#{@tab}}")
|
||||
else unless @ensure or @recovery
|
||||
generatedErrorVariableName = o.scope.freeVariable 'error', reserve: no
|
||||
[@makeCode(" catch (#{generatedErrorVariableName}) {}")]
|
||||
else
|
||||
[]
|
||||
|
||||
Reference in New Issue
Block a user