Skip to content

Commit a516e3c

Browse files
martin-hughesIsaacWoods
authored andcommitted
A more appropriate test failure error
1 parent be78726 commit a516e3c

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/aml/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3337,4 +3337,12 @@ pub enum AmlError {
33373337
/// This is emitted to signal that the library does not support the requested behaviour. This
33383338
/// should eventually never be emitted.
33393339
LibUnimplemented,
3340+
3341+
/// The library has given a response the host does not understand, or the host is otherwise
3342+
/// unable to continue operating the library correctly. The specific reason is given in the
3343+
/// contained String.
3344+
///
3345+
/// This variant is set by the host, not by the library, and can be used when it is convenient
3346+
/// not to construct a more complex error type around [`AmlError`].
3347+
HostError(String),
33403348
}

tools/aml_test_tools/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,14 +325,14 @@ where
325325
match *result {
326326
Object::Integer(0) => Ok(()),
327327
Object::Integer(other) => {
328-
error!("Test _MAIN returned non-zero exit code: {}", other);
329-
// TODO: wrong error - this should probs return a more complex err type
330-
Err(AmlError::NoCurrentOp)
328+
let e = format!("Test _MAIN returned non-zero exit code: {}", other);
329+
error!("{}", e);
330+
Err(AmlError::HostError(e))
331331
}
332332
_ => {
333-
error!("Test _MAIN returned unexpected object type: {}", *result);
334-
// TODO: wrong error
335-
Err(AmlError::NoCurrentOp)
333+
let e = format!("Test _MAIN returned unexpected object type: {}", *result);
334+
error!("{}", e);
335+
Err(AmlError::HostError(e))
336336
}
337337
}
338338
} else {

0 commit comments

Comments
 (0)