5 ms·
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 pre
by oDot 3y 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/ https://filemonger.app/
- tonyhb 3y agoI 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 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?
- ewuhic 3y agoWanna opensource that part as a library, or at least write a blogpost?
- oDot 3y agoI 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/vultix/ts-results https://github.com/badrap/result https://github.com/badrap/result