23 karma · joined March 26, 2020
https://musicq.gitbook.io/unwrapit/recipe/return-result-with...
So this provides a way that told you the function you called might throw. It's more like an alert before a crash.
[res, err] is good, actually I used this style for a long time. `unwrapit` is a nicer way to let you write [res, err], like type hints and other utility methods.
In my opinion, it never tries to prevent people from handling exceptions using try/catch, instead, it enrichs the error handling solutions.
`wrap` function is just a simple way for users to adopt this Result type quickly. I think in projects, developers should create their own Result usually, can check this example.
https://musicq.gitbook.io/unwrapit/recipe/return-result-with...
https://github.com/musicq/unwrapit/blob/d5c437a235ad1f5ad042...
Still think this might be a proper way to deal with errors in JS/TS