tim-smart/droff

how to implement error handling?

meadowsys opened this issue · 2 comments

hello! i was wondering, is there any need or way to watch for and handle errors?

PS it was nice finding this lib after a certain other popular js lib has been hanging on their v13 for a long time heh

Yes, you will need to handle errors in your bot :)

If droff has an error it can't recover from I just let the bot crash and restart. It doesn't happen very often though, maybe once every couple weeks.

For your own logic, there are a few ways of doing it. RxJS has a catchError operator you can use: https://www.learnrxjs.io/learn-rxjs/operators/error_handling/catch

I personally use TaskEither from fp-ts, but its not for everyone.

alright, thank you so much!