scopsy / await-to-js

Async await wrapper for easy error handling without try-catch
http://blog.grossman.io/how-to-write-async-await-without-try-catch-blocks-in-javascript/
MIT License
3.27k stars 153 forks source link

😎-er Name: await-try-catch #48

Closed tylerthebuildor closed 3 years ago

tylerthebuildor commented 3 years ago

I love this lib, but the name is just not as clean as the awesome functionality it provides.

So my proposed re-naming is "await-try-catch" and you could change the function from to() to tc() "tc" for try catch of course.

import tc from "await-try-catch";

const [error, response] = await tc(fetch("/cool"));

It should make the use case more clear to newcomers and although this lib doesn't use a literal try-catch, this lib does replace the use of try-catch in your async code so it's related in that sense.

Most importantly I think naming can be important for adoption and I want everyone to use this so I stop having to deal with actual try-catch blocks or worse .then in other people's code.

What do you think? Give me some thumbs: 👍 or 👎

scopsy commented 3 years ago

Thanks for the suggestion @tylerbuchea , for now, I think we will stick with await-to-js since renaming an npm package is quite a thing if I remember correctly.

tylerthebuildor commented 3 years ago

I forgot I posted this haha. That is a fair point, thanks for the reply scopsy. ❤️