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

new feature: Return detailed error message in python binding #5511

Open
1 task
Xuanwo opened this issue Jan 6, 2025 · 2 comments
Open
1 task

new feature: Return detailed error message in python binding #5511

Xuanwo opened this issue Jan 6, 2025 · 2 comments
Labels
bindings/python enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@Xuanwo
Copy link
Member

Xuanwo commented Jan 6, 2025

Feature Description

Return a detailed error message in the Python binding. For instance, use format!({err:?}) instead of simply err.to_string().

Problem and Solution

Our Python errors are overly simplistic and lack detailed underlying reasons, making it difficult to debug issues such as #5483.

Additional Context

No response

Are you willing to contribute to the development of this feature?

  • Yes, I am willing to contribute to the development of this feature.
@Xuanwo Xuanwo added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed bindings/python labels Jan 6, 2025
@VigneshSK17
Copy link

hi i'd like to work on this issue

@Xuanwo
Copy link
Member Author

Xuanwo commented Jan 7, 2025

Hi, @VigneshSK17, I think we need to fix it here:

pub fn format_pyerr(err: ocore::Error) -> PyErr {
match err.kind() {
ocore::ErrorKind::Unexpected => Unexpected::new_err(err.to_string()),
ocore::ErrorKind::Unsupported => Unsupported::new_err(err.to_string()),
ocore::ErrorKind::ConfigInvalid => ConfigInvalid::new_err(err.to_string()),
ocore::ErrorKind::NotFound => NotFound::new_err(err.to_string()),
ocore::ErrorKind::PermissionDenied => PermissionDenied::new_err(err.to_string()),
ocore::ErrorKind::IsADirectory => IsADirectory::new_err(err.to_string()),
ocore::ErrorKind::NotADirectory => NotADirectory::new_err(err.to_string()),
ocore::ErrorKind::AlreadyExists => AlreadyExists::new_err(err.to_string()),
ocore::ErrorKind::IsSameFile => IsSameFile::new_err(err.to_string()),
ocore::ErrorKind::ConditionNotMatch => ConditionNotMatch::new_err(err.to_string()),
_ => Unexpected::new_err(err.to_string()),
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bindings/python enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants