question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught Promise Error in Request Handler

See original GitHub issue

Please describe the problem you are having in as much detail as possible: When a Promise gets rejected due to a Discord API Error (let’s say Missing Permissions), I’m logging an Uncaught Promise Error for the error, additionally to that, my catch handler on all discord.js promises, logs the same error too.

Log:

1|CharuruD | error: 2017/07/07, 22:04:19.966@ Caught Error: { DiscordAPIError: Missing Permissions
1|CharuruD |     at item.request.gen.end (/var/opt/Discord_Bot/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:69:65)
1|CharuruD |     at then (/var/opt/Discord_Bot/node_modules/snekfetch/src/index.js:243:21)
1|CharuruD |     at <anonymous>
1|CharuruD |     at process._tickCallback (internal/process/next_tick.js:169:7)
1|CharuruD |   name: 'DiscordAPIError',
1|CharuruD |   message: 'Missing Permissions',
1|CharuruD |   code: 50013 }
1|CharuruD | error: 2017/07/07, 22:04:19.970@ Uncaught Promise Error: DiscordAPIError: Missing Permissions
1|CharuruD |     at item.request.gen.end (/var/opt/Discord_Bot/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:69:65)
1|CharuruD |     at then (/var/opt/Discord_Bot/node_modules/snekfetch/src/index.js:243:21)
1|CharuruD |     at <anonymous>

Include a reproducible code sample here, if possible: In my case a send method with a file upload.

message.channel.send({ files: [ botBasepath+'/assets/profile/level.png' ] }).catch(this.client.errorConsole);

Further details:

  • discord.js version: v11.2 (11.1-dev branch)
  • node.js version: v8.1.3
  • Operating system: Debian Jessie x64
  • Priority this issue should have – please be realistic and elaborate if possible: High, since leaking error.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

9reactions
chanjungkimcommented, Jul 21, 2019

Have you solved this issue?

0reactions
ghostcommented, Aug 20, 2017

Hm, funny thing is that it seems to be an issue before the commando PR Uncaught Commando Promise Error (https://github.com/Gawdl3y/discord.js-commando/pull/52). If I await the command promise directly, the issue is gone. I think we can close this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error handling with promises - The Modern JavaScript Tutorial
Promise chains are great at error handling. When a promise rejects, the control jumps to the closest rejection handler.
Read more >
Getting “Uncaught (in promise) Error” from within a catch block
I'm a little new to es6 async and await ; however, it seems very similar to what I'm used to in C#. Get:...
Read more >
Promises - Error Handling - Beginner JavaScript - Wes Bos
What does that log "Uncaught (in promise)" mean? It means that there was an error in one of our promises, but we did...
Read more >
Promise Error Handling - JavaScript Tutorial
In this tutorial, you will learn about promise error handling that shows you how to handle error in promises. ... Uncaught Error: Invalid...
Read more >
Promise.prototype.then() - JavaScript - MDN Web Docs
All handlers attached to the same promise object are always called in the order they were added. Moreover, the two promises returned by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found