Hacker News new | ask | show | jobs
by oDot 953 days ago
In FileMonger[0], which uses Tauri, I have implemented a `Result` logic for errors in TS, similar to what's available in Rust. It's clunkier, but still much preferable to the mess of throwing. Much easier to handle errors and debug.

[0] https://filemonger.app/

2 comments

I don't know Python too well but I think this is covered in TFA. There's a comparison between a Result type using https://github.com/rustedpy/result and an ADT/sum type — and the sum type looks like it's way more ergonomic with Python's current typechecker.

While I like Rust — and Result works really well with `?` — it doesn't actually look like that's the best pattern for Python?

Wanna opensource that part as a library, or at least write a blogpost?
I have written a rudimentary implementation to avoid external dependencies. If you don't mind, a quick google comes up with a couple:

https://github.com/vultix/ts-results

https://github.com/badrap/result