[14.14.1] Check if awaitMessageComponent hit timeout or some other code failed
Would it be possible to detect whether awaitMessageComponent failed because of the timeout, or some other error occurred in the code?
For example:
I'm not sure how to detect/where to get the error class from tho.
I already tried:
DiscordjsErrorCodes.InteractionCollectorError
(as it's rejected with new DiscordjsError(ErrorCodes.InteractionCollectorError, reason)
), however, I got the following error:
"The right-hand side of an 'instanceof' expression must be either of type 'any', a class, function, or other type assignable to the 'Function' interface type, or an object type with a 'Symbol.hasInstance' method."
I guess this is this case since ErrorCodes.InteractionCollectorError
isn't a class, but rather just an error code? Not sure about this tho.
Thanks in advance5 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!just put the awaitMessageComponent in its own try-catch, it will only go to the catch block when no components are received
Yes fair enough, but I'm wondering if it would somehow be possible to detect the error anyway
the error will be DiscordjsError
and error code will be ErrorCodes.InteractionCollectorError
❤️ tysm