Try-catch oneliner

Where does e come from here? I guess this should be either

let value = try? doSomething() : (e) => handleError(e);

or

let value = try? doSomething() : handleError;

Yeah, you're right on that one, it should be the latter, the one without the parenthesis. It's just that handleError should expect to receive a parameter that comes in from the catch clause. Nice catch.

After deep discussions with the community, I'm writing down this idea into a proposal.

I'd love feedback of everyone here and would love some help into detailing it more.

2 Likes