Add try/catch statement support, which can handle exceptions and execute specific clauses based on error pattern matching. It also includes a finally clause, which gets executed regardless of what happened before.
var x: num;
try {
x = fetch("http://localhost") force as num;
} catch (e: InvalidCastException) {
x = 2;
} finally {
print(x as str):
}
Exact behaviour / changes you want
[ ] Add try/catch notation and appropriate semantic analysis.
Is there an existing proposal for this?
This feature does not exist in the latest version
Proposal
Add
try/catch
statement support, which can handle exceptions and execute specific clauses based on error pattern matching. It also includes afinally
clause, which gets executed regardless of what happened before.Exact behaviour / changes you want
try/catch
notation and appropriate semantic analysis.