Allow module consumers to deal with Promise rejections themselves #38
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi again mdibaiee,
I've noticed recently that should Telegram's https://api.telegram.org/bot endpoint return 502 or similar error, the current implementation spews entire error straight to console.error. Which, in my opinion, isn't the most elegant solution, as the error object itself contains a lot of recursive objects and makes entire error log impossible to read and pollutes entire logger (if one is used, say, pm2 native log collector).
Hence I propose a solution that skips spewing error directly into console.error, but rejects bot.send promise instead allowing module consumer to deal with rejections themselves.
Also, provided catch statement in src/index.js eats up the error and continues the promise chain, which on it's own creates potential false-positives.
Hope this makes sense :)
@laurynas-karvelis this is great! I surely haven't had thought of this at the time of writing the API. Thanks a lot Laurynas!
As this is a breaking change, I introduced a new major version.
Published as
node-telegram-api@1.0.0.
Thank you mdibaiee! 👍