Error messages should provide clear, actionable information that helps users understand and resolve the problem. Each error should: 1. Include specific context about what failed
Error messages should provide clear, actionable information that helps users understand and resolve the problem. Each error should:
Example of improving error messages:
// Instead of:
#[error(transparent)]
ManagedPythonError(#[from] managed::Error),
// Prefer:
#[error("Failed to discover managed Python installations")]
ManagedPythonError(#[from] managed::Error),
// Even better with context and remedy:
#[error("Failed to authenticate with {url}")]
#[error("hint: Check your credentials or configure authentication using UV_INDEX_{index}_USERNAME")]
AuthenticationError { url: String, index: String }
When designing error handling:
Enter the URL of a public GitHub repository