Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Catch not running code after try/catch. #191

Open
@jfgorski

Description

In the compiled code below shouldn't the catch block do something with __iced_k like the try block does? So that console.log 'done' gets called if there's an exception while running the sync part of the try.

f = (cb) -> cb()
try
 console.log 'in try'
 throw new Error 'the error'
 await f defer err
catch exn
 console.log 'in catch'
console.log 'done'
// Generated by IcedCoffeeScript 108.0.11
(function() {
 var err, exn, f, iced, __iced_deferrals, __iced_k, __iced_k_noop;
 iced = require('iced-runtime');
 __iced_k = __iced_k_noop = function() {};
 f = function(cb) {
 return cb();
 };
 (function(_this) {
 return (function(__iced_k) {
 try {
 console.log('in try');
 throw new Error('the error');
 __iced_deferrals = new iced.Deferrals(__iced_k, {
 filename: "/home/jfgorski/dev/misc/iced-test-try-catch-bug.coffee"
 });
 f(__iced_deferrals.defer({
 assign_fn: (function() {
 return function() {
 return err = arguments[0];
 };
 })(),
 lineno: 5
 }));
 __iced_deferrals._fulfill();
 } catch (_error) {
 exn = _error;
 return console.log('in catch');
 }
 });
 })(this)((function(_this) {
 return function() {
 return console.log('done');
 };
 })(this));
}).call(this);

Adding an await in the catch fixes the problem:

f = (cb) -> cb()
try
 console.log 'in try'
 throw new Error 'the error'
 await f defer err
catch exn
 console.log 'in catch'
 await f defer err
console.log 'done'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /