DPP
DPP copied to clipboard
Coroutines Hiding Errors Within on_ready Event
Git Commit Reference
ced36fd7652ed24ec3784cbc150722a1e5f6456a
Describe the bug:
When utilising coroutines within the on_ready
function, it's possible for D++ to ignore HTTP error codes and skip on printing any errors.
This specifically happens when a user creates a malformed Slash Command (see below) and proceeds to send it to Discord.
To Reproduce:
Utilising the basic layout of the example bot provided in the Using Slash Commands and Interactions wiki:
- Convert the
on_ready
to a coroutine utilisng-> dpp::task<void>
. - Malform the command data either by leaving a field empty, or overpopulating (>100 characters) -- see Additional Context.
- Resume building the bot as usual.
- Observe as it fails to output the error.
Expected Behaviour:
As expected with a synchronous command creation, it would also be expected that any error codes would also mirror through with a coroutine setup.
Screenshots:
System Details:
- OS: Linux fedora 6.10.3-200.fc40.x86_64
- Version: 40
Additional Context:
Example Minimal Code:
#include <dpp/dpp.h>
int main() {
dpp::cluster bot("...");
bot.on_ready([&bot, logs](const dpp::ready_t &) -> dpp::task<void> {
if (dpp::run_once<struct bulk_register>()) {
const dpp::slashcommand bancmd(
"", // Empty Field
// Overpopulated Field
"............................................................................................................................................................................................................................................... ",
bot.me.id
);
co_await bot.co_global_command_create(bancmd);
}
co_return;
});
bot.start(dpp::st_wait);
return 0;
}