Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Rust panics when fetching messages in a channel and one of the messages has a reaction. #2922

Closed
yorunoken opened this issue Jul 23, 2024 · 1 comment
Labels
duplicate An already existing issue.

Comments

@yorunoken
Copy link

yorunoken commented Jul 23, 2024

example code:

let channel: GuildChannel = get_channel(); 

// Let's say there's a message with a reaction at the 30th message

let messages = channel.messages(&ctx.http, GetMessages::new().limit(10)).await.unwrap(); // Doesn't panic
let messages = channel.messages(&ctx.http, GetMessages::new().limit(20)).await.unwrap(); // Doesn't panic
let messages = channel.messages(&ctx.http, GetMessages::new().limit(29)).await.unwrap(); // Doesn't panic
let messages = channel.messages(&ctx.http, GetMessages::new().limit(30)).await.unwrap(); // Panics

here's the error:

called `Result::unwrap()` on an `Err` value: Json(Error("missing field `burst_colours`", line: 1, column: 3088))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@jamesbt365
Copy link
Member

Well it panics because you have unwrapped the value, unwrapping is not error handling.

Duplicate of #2910, #2909 and #2892. Please check before opening an issue in the future!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
duplicate An already existing issue.
Projects
None yet
Development

No branches or pull requests

2 participants