浏览代码

Merge pull request #83 from Relayz-io/silvestr/near-primitives-function-call-err

Add a new error type for a View call -> FunctionCallError
develop
Predko Silvestr 2 年前
父节点
当前提交
0c9d9b68b5
没有帐户链接到提交者的电子邮件
共有 2 个文件被更改,包括 10 次插入0 次删除
  1. 1
    0
      near-primitives-light/Cargo.toml
  2. 9
    0
      near-primitives-light/src/errors.rs

+ 1
- 0
near-primitives-light/Cargo.toml 查看文件

14
 chrono = { version = "0.4", features = ["serde"] }
14
 chrono = { version = "0.4", features = ["serde"] }
15
 serde = { version = "1", default-features = false, features = ["derive", "rc"] }
15
 serde = { version = "1", default-features = false, features = ["derive", "rc"] }
16
 near-primitives-core = "0.15"
16
 near-primitives-core = "0.15"
17
+near-vm-errors = "3.1"

+ 9
- 0
near-primitives-light/src/errors.rs 查看文件

401
         #[serde(with = "dec_format")]
401
         #[serde(with = "dec_format")]
402
         minimum_stake: Balance,
402
         minimum_stake: Balance,
403
     },
403
     },
404
+    /// An error occurred during a `FunctionCall` Action, parameter is debug message.
405
+    FunctionCallError(near_vm_errors::FunctionCallErrorSer),
406
+    /// Error occurs when a new `ActionReceipt` created by the `FunctionCall` action fails
407
+    /// receipt validation.
408
+    NewReceiptValidationError(ReceiptValidationError),
404
     /// Error occurs when a `CreateAccount` action is called on hex-characters
409
     /// Error occurs when a `CreateAccount` action is called on hex-characters
405
     /// account of length 64.  See implicit account creation NEP:
410
     /// account of length 64.  See implicit account creation NEP:
406
     /// <https://github.com/nearprotocol/NEPs/pull/71>.
411
     /// <https://github.com/nearprotocol/NEPs/pull/71>.
744
             ActionErrorKind::DeleteAccountStaking { account_id } => {
749
             ActionErrorKind::DeleteAccountStaking { account_id } => {
745
                 write!(f, "Account {:?} is staking and can not be deleted", account_id)
750
                 write!(f, "Account {:?} is staking and can not be deleted", account_id)
746
             }
751
             }
752
+            ActionErrorKind::FunctionCallError(s) => write!(f, "{:?}", s),
753
+            ActionErrorKind::NewReceiptValidationError(e) => {
754
+                write!(f, "An new action receipt created during a FunctionCall is not valid: {}", e)
755
+            }
747
             ActionErrorKind::InsufficientStake { account_id, stake, minimum_stake } => write!(f, "Account {} tries to stake {} but minimum required stake is {}", account_id, stake, minimum_stake),
756
             ActionErrorKind::InsufficientStake { account_id, stake, minimum_stake } => write!(f, "Account {} tries to stake {} but minimum required stake is {}", account_id, stake, minimum_stake),
748
             ActionErrorKind::OnlyImplicitAccountCreationAllowed { account_id } => write!(f, "CreateAccount action is called on hex-characters account of length 64 {}", account_id),
757
             ActionErrorKind::OnlyImplicitAccountCreationAllowed { account_id } => write!(f, "CreateAccount action is called on hex-characters account of length 64 {}", account_id),
749
             ActionErrorKind::DeleteAccountWithLargeState { account_id } => write!(f, "The state of account {} is too large and therefore cannot be deleted", account_id),
758
             ActionErrorKind::DeleteAccountWithLargeState { account_id } => write!(f, "The state of account {} is too large and therefore cannot be deleted", account_id),

正在加载...
取消
保存