This is similar to Rust and Go. Go uses positional arguments, where Rust uses enums. Imagine a timeline where we could have Rust-style error handling. No more try-catch blocks. Perhaps we still can. // '?' returns an error if there's an error var res = await foo()?
-
-
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
i love the idea of alternate timeline javascript~
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
there are many packages which do exactly this
-
can you give me some example? I would like to take a look at their source code. Thank you.
- 2 more replies
New conversation -
-
-
Just enjoy the feature of errors that bubble instead of turning this into C and making your life harder. try/catch is useful for sync code and for async code as well + you deal with errors in ONE way that everyone understands.
-
I don’t understand, throw on async code doesn’t get caught by the surrounding catch block.
- 3 more replies
New conversation -
-
-
javascript?
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Yes, that would be amazing. Try/catch is my least favorite part of async/await
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
We can already do this https://gist.github.com/soyuka/011d8519ca013d9770c17c541a16be2f … Would be good if native though...
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.