Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

add #[track_caller] to Row::get() #3672

Merged
merged 1 commit into from
Jan 13, 2025
Merged

Conversation

karambarakat
Copy link
Contributor

@karambarakat karambarakat commented Jan 9, 2025

Row::get should track caller for a better development experience.

the reason for that is that if I have a code like this

my_file.rs

10 |    row.get("non_existing_col")

I would get error message like

thread panicked at 
/../sqlx-core-0.7.4/src/row.rs:72:37:
called `Result::unwrap()` on an `Err` value: ColumnNotFound("non_existing_col")

if I have #[track_caller] I would get error like:

thread panicked at 
/../my_crate/src/my_file.rs:10:37:
called `Result::unwrap()` on an `Err` value: ColumnNotFound("non_existing_col")

Which helps debugging because backtraces are difficult to deal with and are disabled by default in rust.

Does your PR solve an issue?

no, as far as my search

Row::get should track caller for a better development experience.
@abonander abonander changed the title Update row.rs add #[track_caller] to Row::get() Jan 9, 2025
@abonander abonander merged commit b386862 into launchbadge:main Jan 13, 2025
81 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants