fix(tvix/eval): fix JSON error types
The error message is misleading. The errors we return can happen both during serialization or deserialization, though the messages suggested the latter only. Change-Id: I2dafe17ec78ee75cab5937a3a81540fda3175eac Reviewed-on: https://cl.tvl.fyi/c/depot/+/10603 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
This commit is contained in:
parent
c806ee0eb8
commit
9cdb5e17a4
1 changed files with 7 additions and 7 deletions
|
@ -163,8 +163,8 @@ pub enum ErrorKind {
|
|||
error: Rc<io::Error>,
|
||||
},
|
||||
|
||||
/// Errors converting JSON to a value
|
||||
FromJsonError(String),
|
||||
/// Errors parsing JSON, or serializing as JSON.
|
||||
JsonError(String),
|
||||
|
||||
/// Nix value that can not be serialised to JSON.
|
||||
NotSerialisableToJson(&'static str),
|
||||
|
@ -263,7 +263,7 @@ impl From<io::Error> for ErrorKind {
|
|||
impl From<serde_json::Error> for ErrorKind {
|
||||
fn from(err: serde_json::Error) -> Self {
|
||||
// Can't just put the `serde_json::Error` in the ErrorKind since it doesn't impl `Clone`
|
||||
Self::FromJsonError(format!("error in JSON serialization: {err}"))
|
||||
Self::JsonError(err.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -444,8 +444,8 @@ to a missing value in the attribute set(s) included via `with`."#,
|
|||
write!(f, "{error}")
|
||||
}
|
||||
|
||||
ErrorKind::FromJsonError(msg) => {
|
||||
write!(f, "Error converting JSON to a Nix value: {msg}")
|
||||
ErrorKind::JsonError(msg) => {
|
||||
write!(f, "Error converting JSON to a Nix value or back: {msg}")
|
||||
}
|
||||
|
||||
ErrorKind::NotSerialisableToJson(_type) => {
|
||||
|
@ -771,7 +771,7 @@ impl Error {
|
|||
| ErrorKind::ImportParseError { .. }
|
||||
| ErrorKind::ImportCompilerError { .. }
|
||||
| ErrorKind::IO { .. }
|
||||
| ErrorKind::FromJsonError(_)
|
||||
| ErrorKind::JsonError(_)
|
||||
| ErrorKind::NotSerialisableToJson(_)
|
||||
| ErrorKind::FromTomlError(_)
|
||||
| ErrorKind::Xml(_)
|
||||
|
@ -811,7 +811,7 @@ impl Error {
|
|||
ErrorKind::ImportParseError { .. } => "E027",
|
||||
ErrorKind::ImportCompilerError { .. } => "E028",
|
||||
ErrorKind::IO { .. } => "E029",
|
||||
ErrorKind::FromJsonError { .. } => "E030",
|
||||
ErrorKind::JsonError { .. } => "E030",
|
||||
ErrorKind::UnexpectedArgument { .. } => "E031",
|
||||
ErrorKind::RelativePathResolution(_) => "E032",
|
||||
ErrorKind::DivisionByZero => "E033",
|
||||
|
|
Loading…
Reference in a new issue