Skip to content

finally block isn't executed if try/catch has control flow statements #2338

Closed
@idobh2

Description

@idobh2

First time here, first of all - this is an awesome project!!
I'm trying to play around with transpiling async/await code to ES5, and in my attempts I encountered a behavior that's not according to spec.
It seems that a finally block are only executed if the try/catch block had no control flow statements in them.
For example, in the following code, the finally block should be executed even though the try block had a return statement in it

(() => {
	try {
		console.log("trying...")
		return;
	} finally {
		console.log("this should be written"); // this is not showing in espruino
	}
})();

Running this in node/chrome behaves correctly. MDN and the spec confirm this is indeed the desired behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions