bodhi/data/error.rs
1use thiserror::Error;
2
3/// error type that represents an attempt to parse invalid data
4#[derive(Debug, Error)]
5#[error("Invalid value for {}: {}", .name, .value)]
6pub struct InvalidValueError {
7 /// target type the string failed to parse as
8 pub name: &'static str,
9 /// value that failed to parse
10 pub value: String,
11}
12
13impl InvalidValueError {
14 pub(crate) fn new(name: &'static str, value: String) -> Self {
15 InvalidValueError { name, value }
16 }
17}