Skip to content

fix: mention invalid string in warning message #81

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

Closed
wants to merge 1 commit into from

Conversation

joseph-sentry
Copy link
Contributor

the current warning message isn't clear so i'm adding in the invalid string and trying to clarify the message in general

the current warning message isn't clear so i'm adding in the invalid
string and trying to clarify the message in general
@joseph-sentry joseph-sentry requested a review from a team May 20, 2025 18:55
Copy link

codecov bot commented May 20, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 6 lines in your changes missing coverage. Please review.

Project coverage is 95.59%. Comparing base (f4f44a3) to head (61b32a2).
Report is 2 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/junit.rs 54.54% 5 Missing ⚠️
src/raw_upload.rs 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #81      +/-   ##
==========================================
- Coverage   95.78%   95.59%   -0.19%     
==========================================
  Files          17       17              
  Lines        2038     2043       +5     
==========================================
+ Hits         1952     1953       +1     
- Misses         86       90       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

codspeed-hq bot commented May 20, 2025

CodSpeed Performance Report

Merging #81 will not alter performance

Comparing joseph/fix-message (61b32a2) with main (f4f44a3)

Summary

✅ 6 untouched benchmarks

@codecov-notifications
Copy link

Codecov Report

Attention: Patch coverage is 66.66667% with 6 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/junit.rs 54.54% 5 Missing ⚠️
src/raw_upload.rs 66.66% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

if value.len() > 1000 {
anyhow::bail!("string is too long");
return Err(ValidatedStringError::StringTooLong(value));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would truncate this to a more reasonable length:

Suggested change
return Err(ValidatedStringError::StringTooLong(value));
let pos = value.floor_char_boundary(80);
value.truncate(pos);
return Err(ValidatedStringError::StringTooLong(value));

Note that floor_char_boundary is not stable yet, but its quite reasonable to just copy-paste the code from core: https://doc.rust-lang.org/src/core/str/mod.rs.html#407

… or rather do that truncation later on when printing the error, and then also quote / ellipsize the string as well.

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