Skip to content

Commit

Permalink
Create Interrupts for ScriptError
Browse files Browse the repository at this point in the history
  • Loading branch information
eval-exec committed Nov 25, 2024
1 parent 6fc4b7b commit cf10772
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions script/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ pub enum ScriptError {
#[error("VM Internal Error: {0:?}")]
VMInternalError(VMInternalError),

/// Interrupts, such as a Ctrl-C signal
#[error("VM Interrupts")]
Interrupts,

/// Other errors raised in script execution process
#[error("Other Error: {0}")]
Other(String),
Expand Down Expand Up @@ -183,9 +187,7 @@ impl ScriptError {
impl From<TransactionScriptError> for Error {
fn from(error: TransactionScriptError) -> Self {
match error.cause {
ScriptError::Other(ref reason) if reason == "stopped" => {
ErrorKind::Internal.because(error)
}
ScriptError::Interrupts => ErrorKind::Internal.because(error),
_ => ErrorKind::Script.because(error),
}
}
Expand Down

0 comments on commit cf10772

Please sign in to comment.