mirror of
https://github.com/fluencelabs/aquavm
synced 2025-06-25 20:51:32 +00:00
Refactor last error (#202)
This commit is contained in:
@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
pub(crate) use super::Joinable;
|
||||
|
||||
use super::Joinable;
|
||||
use super::LastErrorAffectable;
|
||||
use super::Stream;
|
||||
use crate::execution_step::lambda_applier::LambdaError;
|
||||
use crate::JValue;
|
||||
@ -60,15 +60,15 @@ pub enum CatchableError {
|
||||
|
||||
/// This error type is produced by a match to notify xor that compared values aren't equal.
|
||||
#[error("match is used without corresponding xor")]
|
||||
MatchWithoutXorError,
|
||||
MatchValuesNotEqual,
|
||||
|
||||
/// This error type is produced by a mismatch to notify xor that compared values aren't equal.
|
||||
#[error("mismatch is used without corresponding xor")]
|
||||
MismatchWithoutXorError,
|
||||
MismatchValuesEqual,
|
||||
|
||||
/// This error type is produced by a fail instruction.
|
||||
#[error("fail with ret_code '{ret_code}' and error_message '{error_message}' is used without corresponding xor")]
|
||||
FailWithoutXorError { ret_code: i64, error_message: String },
|
||||
#[error("fail with '{error}' is used without corresponding xor")]
|
||||
UserError { error: Rc<JValue> },
|
||||
|
||||
/// An error occurred while trying to apply lambda to a value.
|
||||
#[error(transparent)]
|
||||
@ -98,6 +98,15 @@ impl ToErrorCode for CatchableError {
|
||||
}
|
||||
}
|
||||
|
||||
impl LastErrorAffectable for CatchableError {
|
||||
fn affects_last_error(&self) -> bool {
|
||||
!matches!(
|
||||
self,
|
||||
CatchableError::MatchValuesNotEqual | CatchableError::MismatchValuesEqual
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! log_join {
|
||||
($($args:tt)*) => {
|
||||
log::info!(target: air_log_targets::JOIN_BEHAVIOUR, $($args)*)
|
||||
|
Reference in New Issue
Block a user