Skip to content

Commit 92db67c

Browse files
committed
A more appropriate test failure error
1 parent 93d46d2 commit 92db67c

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

src/aml/mod.rs

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

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)