MCPcopy Index your code
hub / github.com/endbasic/endbasic / handle_exception

Method handle_exception

core/src/vm/mod.rs:335–364  ·  view source on GitHub ↗

Handles an exception raised at `pc`, corresponding to `pos`, with `message`. Returns true if the error was handled.

(
        &mut self,
        image: &Image,
        pc: usize,
        pos: LineCol,
        message: String,
    )

Source from the content-addressed store, hash-verified

333
334 /// Handles an exception raised at `pc`, corresponding to `pos`, with `message`. Returns true if the error was handled.
335 fn handle_exception(
336 &mut self,
337 image: &Image,
338 pc: usize,
339 pos: LineCol,
340 message: String,
341 ) -> bool {
342 self.last_error = Some((pos, message));
343
344 match self.context.error_handler() {
345 ErrorHandler::None => false,
346 ErrorHandler::Jump { active: true, .. } => false,
347 ErrorHandler::Jump { active: false, addr } => {
348 self.context.set_error_handler_active();
349 self.context.set_pc(addr);
350 true
351 }
352 ErrorHandler::ResumeNext => {
353 let mut next_pc = image.code.len();
354 for (idx, meta) in image.debug_info.instrs.iter().enumerate().skip(pc + 1) {
355 if meta.is_stmt_start {
356 next_pc = idx;
357 break;
358 }
359 }
360 self.context.set_pc(next_pc);
361 true
362 }
363 }
364 }
365
366 /// Returns the value of the global scalar variable `key` as a `ConstantDatum`.
367 ///

Callers 2

handle_upcall_resultMethod · 0.80
execMethod · 0.80

Calls 6

error_handlerMethod · 0.80
set_pcMethod · 0.80
iterMethod · 0.80
lenMethod · 0.45
enumerateMethod · 0.45

Tested by

no test coverage detected