fn raise_exception(&mut self, err_opt: Option<failure::Error>, _undo: bool) -> Status {
        let (err, exception) = if let Some(err) = err_opt {
            if let Some(exception) = tvm_exception_full(&err) {
                (err, exception)
            } else {
                log::trace!(target: "tvm", "BAD CODE: {}\n", self.cmd_code);
                return Err(err)
            }
        } else {
            return Ok(())
        };
        if exception.exception_code() == Some(ExceptionCode::OutOfGas) {
            self.step += 1;
            log::trace!(target: "tvm", "OUT OF GAS CODE: {}\n", self.cmd_code);
            return Err(err)
        }
        self.try_use_gas(Gas::exception_price())?;
        if let Err(err) = self.gas.check_gas_remaining() {
            return self.raise_exception(Some(err), false)
        }
        let n = self.cmd.vars.len();
        // self.trace_info(EngineTraceInfoType::Exception, self.gas_used(), Some(format!("EXCEPTION: {}", err)));
        if let Some(c2) = self.ctrls.get_mut(2) {
            self.cc.stack.push(exception.value.clone());
            self.cc.stack.push(int!(exception.exception_or_custom_code()));
            c2.as_continuation_mut()?.nargs = 2;
            switch(self, ctrl!(2))?;
        } else if let Some(number) = exception.is_normal_termination() {
            let cont = ContinuationData::with_type(ContinuationType::Quit(number));
            self.cmd.push_var(StackItem::Continuation(Arc::new(cont)));
            self.cc.stack.push(exception.value);
            self.cmd.vars[n].as_continuation_mut()?.nargs = 1;
            switch(self, var!(n))?;
        } else {
            self.trace_info(EngineTraceInfoType::Exception, self.gas_used(), Some(format!("UNHANDLED EXCEPTION: {}", err)));
            log::trace!(target: "tvm", "BAD CODE: {}\n", self.cmd_code);
            return Err(err)
        }
        Ok(())
    }
// raises the exception and tries to dispatch it via c(2).
// If c(2) is not set, returns that exception, otherwise, returns None
raises the exception and tries to dispatch it via c(2).
If c(2) is not set, returns that exception, otherwise, returns None
raises the exception and tries to dispatch it via c ( 2 ) . If c ( 2 ) is not set returns that exception otherwise returns None
fn raise_exception(&mut self, err_opt: Option<failure::Error>, _undo: bool) -> Status {
        let (err, exception) = if let Some(err) = err_opt {
            if let Some(exception) = tvm_exception_full(&err) {
                (err, exception)
            } else {
                log::trace!(target: "tvm", "BAD CODE: {}\n", self.cmd_code);
                return Err(err)
            }
        } else {
            return Ok(())
        };
        if exception.exception_code() == Some(ExceptionCode::OutOfGas) {
            self.step += 1;
            log::trace!(target: "tvm", "OUT OF GAS CODE: {}\n", self.cmd_code);
            return Err(err)
        }
        self.try_use_gas(Gas::exception_price())?;
        if let Err(err) = self.gas.check_gas_remaining() {
            return self.raise_exception(Some(err), false)
        }
        let n = self.cmd.vars.len();
        // self.trace_info(EngineTraceInfoType::Exception, self.gas_used(), Some(format!("EXCEPTION: {}", err)));
        if let Some(c2) = self.ctrls.get_mut(2) {
            self.cc.stack.push(exception.value.clone());
            self.cc.stack.push(int!(exception.exception_or_custom_code()));
            c2.as_continuation_mut()?.nargs = 2;
            switch(self, ctrl!(2))?;
        } else if let Some(number) = exception.is_normal_termination() {
            let cont = ContinuationData::with_type(ContinuationType::Quit(number));
            self.cmd.push_var(StackItem::Continuation(Arc::new(cont)));
            self.cc.stack.push(exception.value);
            self.cmd.vars[n].as_continuation_mut()?.nargs = 1;
            switch(self, var!(n))?;
        } else {
            self.trace_info(EngineTraceInfoType::Exception, self.gas_used(), Some(format!("UNHANDLED EXCEPTION: {}", err)));
            log::trace!(target: "tvm", "BAD CODE: {}\n", self.cmd_code);
            return Err(err)
        }
        Ok(())
    }
fn raise_exception ( & mut self , err_opt : Option < failure :: Error > , _undo : bool ) -> Status { let ( err , exception ) = if let Some ( err ) = err_opt { if let Some ( exception ) = tvm_exception_full ( & err ) { ( err , exception ) } else { log :: trace ! ( target " " " \n " self cmd_code ) ; return Err ( err ) } } else { return Ok ( ( ) ) } ; if exception . exception_code ( ) == Some ( ExceptionCode :: OutOfGas ) { self . step += 1 ; log :: trace ! ( target " " " \n " self cmd_code ) ; return Err ( err ) } self . try_use_gas ( Gas :: exception_price ( ) ) ? ; if let Err ( err ) = self . gas . check_gas_remaining ( ) { return self . raise_exception ( Some ( err ) , false ) } let n = self . cmd . vars . len ( ) ; // self.trace_info(EngineTraceInfoType::Exception, self.gas_used(), Some(format!("EXCEPTION: {}", err))); if let Some ( c2 ) = self . ctrls . get_mut ( 2 ) { self . cc . stack . push ( exception . value . clone ( ) ) ; self . cc . stack . push ( int ! ( exception exception_or_custom_code ( ) ) ) ; c2 . as_continuation_mut ( ) ? . nargs = 2 ; switch ( self , ctrl ! ( 2 ) ) ? ; } else if let Some ( number ) = exception . is_normal_termination ( ) { let cont = ContinuationData :: with_type ( ContinuationType :: Quit ( number ) ) ; self . cmd . push_var ( StackItem :: Continuation ( Arc :: new ( cont ) ) ) ; self . cc . stack . push ( exception . value ) ; self . cmd . vars [ n ] . as_continuation_mut ( ) ? . nargs = 1 ; switch ( self , var ! ( n ) ) ? ; } else { self . trace_info ( EngineTraceInfoType :: Exception , self . gas_used ( ) , Some ( format ! ( " " err ) ) ) ; log :: trace ! ( target " " " \n " self cmd_code ) ; return Err ( err ) } Ok ( ( ) ) }
raises the exception and tries to dispatch it via c(2).
raises the exception and tries to dispatch it via c ( 2 ) .
&mut self
err_opt
Option<failure::Error>
_undo
bool
&mut self
err_opt
Option<failure::Error>
_undo
bool