#promise rejections
1 messages · Page 1 of 1 (latest)
no, I mean how do you handle promises within your run method?
do you await or return them?
if you await or return all of them the handler should be able to catch them
ok, so return await i.editReply() isnt an issue?
it's not
for other promises it looks like this
const player = await getPlayer(tag).catch(e => {
if (e?.response?.status === 404) throw '**Player not found.**';
throw e?.response?.statusText || 'Unexpected Error.';
});
and then it is caught in the code above this ^
yes, that will be catched in the outer try catch too
hmm
discord isnt giving me any useful errors and its making this difficult to figure out
just Unknown Interaction and then it crashes
you can listen to "unhandledRejection" on process
no issues in development though, cant replicate it
ah true
so just log it everytime theres an unhandled rejection?
you can do that, though you should follow the stack trace and handle them where they are thrown initially
gotcha, what exactly would that look like?
process.on('unhandledRejection', e => {
//?
});
just console.error(e)?
sure