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

Improve openvasd error messages #1784

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion rust/src/feed/verify/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ where
let helper = VHelper::new(gnupghome);

let sign_path = path.as_ref().to_path_buf().join("sha256sums.asc");
let mut sig_file = File::open(sign_path).unwrap();
let mut sig_file = File::open(&sign_path)
.unwrap_or_else(|e| panic!("Could not find signature at {sign_path:?}. {e}"));
let mut signature = Vec::new();
let _ = sig_file.read_to_end(&mut signature);

Expand Down
5 changes: 3 additions & 2 deletions rust/src/openvasd/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,10 @@ impl Config {

fn from_file<P>(path: P) -> Self
where
P: AsRef<std::path::Path> + std::fmt::Display,
P: AsRef<std::path::Path> + std::fmt::Display + std::fmt::Debug,
{
let config = std::fs::read_to_string(path).unwrap();
let config = std::fs::read_to_string(&path)
.unwrap_or_else(|e| panic!("Failed to read openvasd config from file: {path:?}. {e}"));
toml::from_str(&config).unwrap()
}

Expand Down
2 changes: 1 addition & 1 deletion rust/src/storage/redis/dberror.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl From<RedisError> for DbError {
| ErrorKind::InvalidClientConfig
| ErrorKind::Moved
| ErrorKind::Ask => DbError::ConfigurationError(err.to_string()),
ErrorKind::IoError => DbError::PoisonedLock(err.to_string()),
ErrorKind::IoError => DbError::IoError(err.to_string()),
ErrorKind::TypeError
| ErrorKind::ClientError
| ErrorKind::CrossSlot
Expand Down
Loading