How to handle UnhandledPromiseRejection?

UPDATE: It turns out my bot was IP-banned by Discord, I have put my project name in the megathread and hopefully it will be resolved soon. Thank you everyone who tried to help me!

In my project, tidy-saffron, every time I attempt to run it it gives me an UnhandledPromiseRejection and I am unable to find the place to put the catch-try block. If anyone has any idea for how to help, please let me know. Thank you!

@salface what is the full text of the error? I didn’t see anything immediately wrong when I scanned over the code in your project, but the full error might have some clues!

@househaunt, The errors I am getting are:
(node:23111) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

(node:23111) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Yikes I see what you mean – not very informative to me. An async function without a catch block hmmmm

1 Like