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

Tidy up error implementations #515

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

danieleades
Copy link
Contributor

No description provided.

}
(Some(msg), None) => write!(f, "{msg}\nLocation: {}", self.location),
(None, Some(source)) => write!(f, "{source}\nLocation: {}", self.location),
(None, None) => write!(f, "\nLocation: {}", self.location),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tomhoule i've copied the original implementation here, but i suspect the leading newline here is not intentional?

Copy link
Member

Choose a reason for hiding this comment

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

Probably not. Ideally we'd have tests for the display impl.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can add those before this lands

@@ -17,3 +17,4 @@ quote = "^1.0"
serde_json = "1.0"
serde = { version = "^1.0", features = ["derive"] }
syn = "^1.0"
thiserror = "2.0.11"
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer to avoid adding dependencies that are not 100% needed in this library. I like thiserror for application code, but I wouldn't use it there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are you possibly confusing 'thiserror' and 'anyhow'? Thiserror targets libraries, not applications. It's a compile-time-only dependency- not exposed in public interface (it generates the boilerplate you would otherwise write by hand)

Copy link
Member

Choose a reason for hiding this comment

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

It still adds to the compile times and the dependencies to audit. It's a good crate, but I wouldn't use it for a couple of modules in a library. Arguably, it's not worse than serde-derive which we already have in there, but I'm not sure why, we should remove if possible.

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