mirror of
https://github.com/fluencelabs/marine.git
synced 2024-12-12 14:55:32 +00:00
update stepper errors
This commit is contained in:
parent
1b3c73f03b
commit
1c2578ede4
48
Cargo.lock
generated
48
Cargo.lock
generated
@ -693,15 +693,6 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "fluence"
|
|
||||||
version = "0.2.8"
|
|
||||||
source = "git+https://github.com/fluencelabs/rust-sdk#4d6c4f6b862c22ebd8db7244daac0adf3f1bd2fd"
|
|
||||||
dependencies = [
|
|
||||||
"fluence-sdk-macro 0.2.8 (git+https://github.com/fluencelabs/rust-sdk)",
|
|
||||||
"fluence-sdk-main 0.2.8 (git+https://github.com/fluencelabs/rust-sdk)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fluence"
|
name = "fluence"
|
||||||
version = "0.2.8"
|
version = "0.2.8"
|
||||||
@ -712,6 +703,15 @@ dependencies = [
|
|||||||
"fluence-sdk-main 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fluence-sdk-main 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fluence"
|
||||||
|
version = "0.2.8"
|
||||||
|
source = "git+https://github.com/fluencelabs/rust-sdk#4d6c4f6b862c22ebd8db7244daac0adf3f1bd2fd"
|
||||||
|
dependencies = [
|
||||||
|
"fluence-sdk-macro 0.2.8 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||||
|
"fluence-sdk-main 0.2.8 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fluence-app-service"
|
name = "fluence-app-service"
|
||||||
version = "0.1.8"
|
version = "0.1.8"
|
||||||
@ -747,14 +747,6 @@ dependencies = [
|
|||||||
"wasmer-wasi-fl",
|
"wasmer-wasi-fl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "fluence-sdk-macro"
|
|
||||||
version = "0.2.8"
|
|
||||||
source = "git+https://github.com/fluencelabs/rust-sdk#4d6c4f6b862c22ebd8db7244daac0adf3f1bd2fd"
|
|
||||||
dependencies = [
|
|
||||||
"fluence-sdk-wit 0.2.8 (git+https://github.com/fluencelabs/rust-sdk)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fluence-sdk-macro"
|
name = "fluence-sdk-macro"
|
||||||
version = "0.2.8"
|
version = "0.2.8"
|
||||||
@ -765,13 +757,11 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fluence-sdk-main"
|
name = "fluence-sdk-macro"
|
||||||
version = "0.2.8"
|
version = "0.2.8"
|
||||||
source = "git+https://github.com/fluencelabs/rust-sdk#4d6c4f6b862c22ebd8db7244daac0adf3f1bd2fd"
|
source = "git+https://github.com/fluencelabs/rust-sdk#4d6c4f6b862c22ebd8db7244daac0adf3f1bd2fd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fluence-sdk-macro 0.2.8 (git+https://github.com/fluencelabs/rust-sdk)",
|
"fluence-sdk-wit 0.2.8 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||||
"log",
|
|
||||||
"serde",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -786,9 +776,20 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fluence-sdk-wit"
|
name = "fluence-sdk-main"
|
||||||
version = "0.2.8"
|
version = "0.2.8"
|
||||||
source = "git+https://github.com/fluencelabs/rust-sdk#4d6c4f6b862c22ebd8db7244daac0adf3f1bd2fd"
|
source = "git+https://github.com/fluencelabs/rust-sdk#4d6c4f6b862c22ebd8db7244daac0adf3f1bd2fd"
|
||||||
|
dependencies = [
|
||||||
|
"fluence-sdk-macro 0.2.8 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||||
|
"log",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fluence-sdk-wit"
|
||||||
|
version = "0.2.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "560baf91197ded38a99a5c94ff366a3dd971ebf33f5d987ecce31d3dedf86d17"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -801,8 +802,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "fluence-sdk-wit"
|
name = "fluence-sdk-wit"
|
||||||
version = "0.2.8"
|
version = "0.2.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/fluencelabs/rust-sdk#4d6c4f6b862c22ebd8db7244daac0adf3f1bd2fd"
|
||||||
checksum = "560baf91197ded38a99a5c94ff366a3dd971ebf33f5d987ecce31d3dedf86d17"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -22,45 +22,63 @@ use crate::AquamarineVMError;
|
|||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
||||||
pub(crate) struct RawStepperOutcome {
|
pub(crate) struct RawStepperOutcome {
|
||||||
pub ret_code: i32,
|
pub ret_code: i32,
|
||||||
pub data: String,
|
pub data: String,
|
||||||
pub next_peer_pks: Vec<String>,
|
pub next_peer_pks: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
||||||
pub struct StepperOutcome {
|
pub struct StepperOutcome {
|
||||||
pub data: String,
|
pub data: String,
|
||||||
pub next_peer_pks: Vec<String>,
|
pub next_peer_pks: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub enum StepperError {
|
pub enum StepperError {
|
||||||
/// Errors occurred while parsing aqua script in the form of S expressions.
|
/// Errors occurred while parsing aqua script in the form of S expressions.
|
||||||
SExprParseError(String),
|
SExprParseError(String),
|
||||||
|
|
||||||
/// Errors occurred while parsing supplied data.
|
/// Errors occurred while parsing supplied data.
|
||||||
DataParseError(String),
|
DataSerdeError(String),
|
||||||
|
|
||||||
|
/// Errors occurred while parsing function arguments of an expression.
|
||||||
|
FuncArgsSerdeError(String),
|
||||||
|
|
||||||
|
/// Errors occurred while parsing returned by call_service value.
|
||||||
|
CallServiceSerdeError(String),
|
||||||
|
|
||||||
/// Indicates that environment variable with name CURRENT_PEER_ID isn't set.
|
/// Indicates that environment variable with name CURRENT_PEER_ID isn't set.
|
||||||
CurrentPeerIdNotSet(String),
|
CurrentPeerIdEnvError(String),
|
||||||
|
|
||||||
/// Semantic errors in instructions.
|
/// Semantic errors in instructions.
|
||||||
InstructionError(String),
|
InstructionError(String),
|
||||||
|
|
||||||
/// Semantic errors in instructions.
|
/// An error is occurred while calling local service via call_service.
|
||||||
LocalServiceError(String),
|
LocalServiceError(String),
|
||||||
|
|
||||||
/// Value with such name isn't presence in data.
|
/// Value for such name isn't presence in data.
|
||||||
VariableNotFound(String),
|
VariableNotFound(String),
|
||||||
|
|
||||||
/// Value with such path wasn't found in data.
|
/// Multiple values for such name found.
|
||||||
|
MultipleVariablesFound(String),
|
||||||
|
|
||||||
|
/// Value with such path wasn't found in data with such error.
|
||||||
VariableNotInJsonPath(String),
|
VariableNotInJsonPath(String),
|
||||||
|
|
||||||
|
/// Value for such name isn't presence in data.
|
||||||
|
IncompatibleJValueType(String),
|
||||||
|
|
||||||
/// Multiple values found for such json path.
|
/// Multiple values found for such json path.
|
||||||
MultipleValuesInJsonPath(String),
|
MultipleValuesInJsonPath(String),
|
||||||
|
|
||||||
|
/// Fold state wasn't found for such iterator name.
|
||||||
|
FoldStateNotFound(String),
|
||||||
|
|
||||||
|
/// Multiple fold states found for such iterator name.
|
||||||
|
MultipleFoldStates(String),
|
||||||
|
|
||||||
/// Related to such ret_code that doesn't have match with current StepperError.
|
/// Related to such ret_code that doesn't have match with current StepperError.
|
||||||
UnknownError(String),
|
UnknownError(String),
|
||||||
}
|
}
|
||||||
@ -71,13 +89,19 @@ impl std::fmt::Display for StepperError {
|
|||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
|
||||||
match self {
|
match self {
|
||||||
StepperError::SExprParseError(err_msg) => write!(f, "{}", err_msg),
|
StepperError::SExprParseError(err_msg) => write!(f, "{}", err_msg),
|
||||||
StepperError::DataParseError(err_msg) => write!(f, "{}", err_msg),
|
StepperError::DataSerdeError(err_msg) => write!(f, "{}", err_msg),
|
||||||
StepperError::CurrentPeerIdNotSet(err_msg) => write!(f, "{}", err_msg),
|
StepperError::FuncArgsSerdeError(err_msg) => write!(f, "{}", err_msg),
|
||||||
|
StepperError::CallServiceSerdeError(err_msg) => write!(f, "{}", err_msg),
|
||||||
|
StepperError::CurrentPeerIdEnvError(err_msg) => write!(f, "{}", err_msg),
|
||||||
StepperError::InstructionError(err_msg) => write!(f, "{}", err_msg),
|
StepperError::InstructionError(err_msg) => write!(f, "{}", err_msg),
|
||||||
StepperError::LocalServiceError(err_msg) => write!(f, "{}", err_msg),
|
StepperError::LocalServiceError(err_msg) => write!(f, "{}", err_msg),
|
||||||
StepperError::VariableNotFound(err_msg) => write!(f, "{}", err_msg),
|
StepperError::VariableNotFound(err_msg) => write!(f, "{}", err_msg),
|
||||||
|
StepperError::MultipleVariablesFound(err_msg) => write!(f, "{}", err_msg),
|
||||||
StepperError::VariableNotInJsonPath(err_msg) => write!(f, "{}", err_msg),
|
StepperError::VariableNotInJsonPath(err_msg) => write!(f, "{}", err_msg),
|
||||||
|
StepperError::IncompatibleJValueType(err_msg) => write!(f, "{}", err_msg),
|
||||||
StepperError::MultipleValuesInJsonPath(err_msg) => write!(f, "{}", err_msg),
|
StepperError::MultipleValuesInJsonPath(err_msg) => write!(f, "{}", err_msg),
|
||||||
|
StepperError::FoldStateNotFound(err_msg) => write!(f, "{}", err_msg),
|
||||||
|
StepperError::MultipleFoldStates(err_msg) => write!(f, "{}", err_msg),
|
||||||
StepperError::UnknownError(err_msg) => write!(f, "{}", err_msg),
|
StepperError::UnknownError(err_msg) => write!(f, "{}", err_msg),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,13 +125,19 @@ impl TryFrom<RawStepperOutcome> for StepperOutcome {
|
|||||||
next_peer_pks: raw_outcome.next_peer_pks,
|
next_peer_pks: raw_outcome.next_peer_pks,
|
||||||
}),
|
}),
|
||||||
1 => to_vm_error!(SExprParseError),
|
1 => to_vm_error!(SExprParseError),
|
||||||
2 => to_vm_error!(DataParseError),
|
2 => to_vm_error!(DataSerdeError),
|
||||||
3 => to_vm_error!(CurrentPeerIdNotSet),
|
3 => to_vm_error!(FuncArgsSerdeError),
|
||||||
4 => to_vm_error!(InstructionError),
|
4 => to_vm_error!(CallServiceSerdeError),
|
||||||
5 => to_vm_error!(LocalServiceError),
|
5 => to_vm_error!(CurrentPeerIdEnvError),
|
||||||
6 => to_vm_error!(VariableNotFound),
|
6 => to_vm_error!(InstructionError),
|
||||||
7 => to_vm_error!(VariableNotInJsonPath),
|
7 => to_vm_error!(LocalServiceError),
|
||||||
8 => to_vm_error!(MultipleValuesInJsonPath),
|
8 => to_vm_error!(VariableNotFound),
|
||||||
|
9 => to_vm_error!(MultipleVariablesFound),
|
||||||
|
10 => to_vm_error!(VariableNotInJsonPath),
|
||||||
|
11 => to_vm_error!(IncompatibleJValueType),
|
||||||
|
12 => to_vm_error!(MultipleValuesInJsonPath),
|
||||||
|
13 => to_vm_error!(FoldStateNotFound),
|
||||||
|
14 => to_vm_error!(MultipleFoldStates),
|
||||||
_ => to_vm_error!(UnknownError),
|
_ => to_vm_error!(UnknownError),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user