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

lib: add more error context when loading fails #117

Merged
merged 1 commit into from
Jul 9, 2024

Conversation

cpu
Copy link
Member

@cpu cpu commented Jul 9, 2024

Previously the code path that reads from CertPaths that configure a dir from the environment lacked helpful context if the dir couldn't be read. Similarly, the code path that read from a CertPaths file would add helpful context if rustls_pemfile returned an error, but not if the file open failed.

This commit centralizes the job of adding useful context into CertPaths.load(). The rustls_pemfile specific part in the file path processing can then be removed. This ensures for both dirs and files that if the operation fails there's useful context as to why.

Resolves #116

@cpu cpu self-assigned this Jul 9, 2024
src/lib.rs Outdated Show resolved Hide resolved
@cpu cpu force-pushed the cpu-error-context branch from 9e648ef to d64cd14 Compare July 9, 2024 20:15
Previously the code path that read from `CertPaths` that configure a dir
from the environment lacked helpful context if the dir couldn't be read.
Similarly, the code path that read from a `CertPaths` file would add
helpful context if `rustls_pemfile` returned an error, but not if the
file open failed.

This commit centralizes the job of adding useful context into
`CertPaths.load()`. The `rustls_pemfile` specific part in the file path
processing can then be removed. This ensures for both dirs and files
that if the operation fails there's useful context as to why.
@cpu cpu force-pushed the cpu-error-context branch from d64cd14 to 7062d24 Compare July 9, 2024 20:16
Copy link
Member

@djc djc left a comment

Choose a reason for hiding this comment

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

Great!

@cpu
Copy link
Member Author

cpu commented Jul 9, 2024

Feels uninteresting enough that I'm not going to block on a 2nd review. Will iterate for any post-merge feedback 🌠

@cpu cpu added this pull request to the merge queue Jul 9, 2024
Merged via the queue into rustls:main with commit 1a6052b Jul 9, 2024
14 checks passed
@cpu cpu deleted the cpu-error-context branch July 9, 2024 21:03
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.

Problem with certificates after 0.7.1
2 participants