MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / onBroken

Method onBroken

tools/xsbug-log/xsbug-debugmachine.js:558–599  ·  view source on GitHub ↗
(path, line, text)

Source from the content-addressed store, hash-verified

556 }
557
558 onBroken(path, line, text) {
559 // Auto-continue for non-interactive connections (e.g., mcsim)
560 if (!this.interactive) {
561 this.doGo();
562 return;
563 }
564
565 this.broken = true;
566 this.running = false;
567
568 if (path) {
569 this.currentPath = path;
570 this.knownPaths.add(path);
571 }
572 if (line)
573 this.currentLine = line;
574
575 // Handle temporary breakpoint (until command)
576 if (this.temporaryBreakpoint) {
577 const temporaryBreakpoint = this.temporaryBreakpoint;
578 this.doClearBreakpoint(temporaryBreakpoint.path, temporaryBreakpoint.line);
579 // Remove from user breakpoints if it was added there
580 const i = this.breakpoints.findIndex(bp => bp.path === temporaryBreakpoint.path && bp.line === temporaryBreakpoint.line);
581 if (i >= 0)
582 this.breakpoints.splice(i, 1);
583 delete this.temporaryBreakpoint;
584 }
585
586 this.clearLine();
587
588 const msg = text ? text.replace(/\n$/, '') : '';
589 if (this.onBreakpointHit) this.onBreakpointHit();
590
591 this.report('stopped', {
592 path: this.currentPath ?? '',
593 line: this.currentLine ?? 0,
594 reason: msg
595 }, undefined, (data) => {
596 this.printLocation(data.reason);
597 this.showPrompt();
598 });
599 }
600
601 onLogged(path, line, data) {
602 this.log += data;

Callers

nothing calls this directly

Calls 9

clearLineMethod · 0.95
reportMethod · 0.95
printLocationMethod · 0.95
showPromptMethod · 0.95
doGoMethod · 0.80
replaceMethod · 0.80
addMethod · 0.65
findIndexMethod · 0.65
doClearBreakpointMethod · 0.45

Tested by

no test coverage detected