Skip to content

Commit 92dd265

Browse files
committed
bam
1 parent 3c53c33 commit 92dd265

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

‎v3/js/opt-live.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4646
4747
- support pasting in code via URL, which will be important for
4848
transporting the user from regular OPT to live mode
49+
- add "Generate permanent link" button, but no need for iframe embed btn
4950
5051
- make sure server logging works properly, esp. session and user IDs,
5152
and slider interactions
5253
53-
- add "Generate permanent link" button, but no need for iframe embed btn
54-
5554
- if these Ace enhancements look good, then I can also use them for
5655
Codeopticon as well!
5756

‎v3/js/pytutor.js‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ var curVisualizerID = 1; // global to uniquely identify each ExecutionVisualizer
7474
// trace - a full execution trace
7575
//
7676
// params is an object containing optional parameters, such as:
77-
// jumpToEnd - if non-null, jump to the very end of execution
77+
// jumpToEnd - if non-null, jump to the very end of execution if
78+
// there's no error, or if there's an error, jump to the
79+
// FIRST ENTRY with an error
7880
// startingInstruction - the (zero-indexed) execution point to display upon rendering
7981
// hideOutput - hide "Program output" display
8082
// codeDivHeight - maximum height of #pyCodeOutputDiv (in integer pixels)
@@ -781,7 +783,22 @@ ExecutionVisualizer.prototype.render = function() {
781783
}
782784

783785
if (this.params.jumpToEnd) {
784-
this.curInstr = this.curTrace.length - 1;
786+
var firstErrorStep = -1;
787+
for (var i = 0; i < this.curTrace.length; i++) {
788+
var e = this.curTrace[i];
789+
if (e.event == 'exception' || e.event == 'uncaught_exception') {
790+
firstErrorStep = i;
791+
break;
792+
}
793+
}
794+
795+
// set to first error step if relevant since that's more informative
796+
// than simply jumping to the very end
797+
if (firstErrorStep >= 0) {
798+
this.curInstr = firstErrorStep;
799+
} else {
800+
this.curInstr = this.curTrace.length - 1;
801+
}
785802
}
786803

787804
if (this.params.hideCode) {

0 commit comments

Comments
 (0)