Any way to prevent async/await orgies?

I'm "asyncawaitifying" my application to enhace its maintainability.

Basically, most of my non-trivial functions now end with an error handling like so

except
 Await(MyMesageDlg.ShowDialog('thats that error again'...))

Now, if I have that function called, say, 10 stack levels deep, like e.g. so

F1(F2(F3(...F10()))))))

and say F10 has this Await(MyMessageDlg..), then I seem to also have to call EVERY previous function with Await, like so

Await(F1(..Await(F2(...Await(F3...

and all functions have to be flagged [async], up to the root Form-OnClick handler.

This is really nasty!

Did I miss something? Is there some smart way to circumvent that?

Thanks alot!

Walter

Walter,
I am no expert on async / await subjects in Javascript or Pas2JS but realized the same behaviour. Also if you don't use the await() along the call chain than at that location the thing becomes async.

Yes, that's true, and no warning from the compiler. Not easy to maintain!

We'll check with the pas2js compiler team if they see it feasible to at least add a compiler warning.