@@ -1235,6 +1235,8 @@ function executePythonCode(pythonSourceCode,
12351235 function execCallback ( dataFromBackend ) {
12361236 var trace = dataFromBackend . trace ;
12371237
1238+ var killerException = null ;
1239+
12381240 // don't enter visualize mode if there are killer errors:
12391241 if ( ! trace ||
12401242 ( trace . length == 0 ) ||
@@ -1243,9 +1245,11 @@ function executePythonCode(pythonSourceCode,
12431245 handleUncaughtExceptionFunc ( trace ) ;
12441246
12451247 if ( trace . length == 1 ) {
1248+ killerException = trace [ 0 ] ; // killer!
12461249 setFronendError ( [ trace [ 0 ] . exception_msg ] ) ;
12471250 }
12481251 else if ( trace [ trace . length - 1 ] . exception_msg ) {
1252+ killerException = trace [ trace . length - 1 ] ; // killer!
12491253 setFronendError ( [ trace [ trace . length - 1 ] . exception_msg ] ) ;
12501254 }
12511255 else {
@@ -1279,9 +1283,14 @@ function executePythonCode(pythonSourceCode,
12791283
12801284 // debounce to compress a bit ... 250ms feels "right"
12811285 $ . doTimeout ( 'updateOutputLogEvent' , 250 , function ( ) {
1282- logEvent ( { type : 'updateOutput' , step : args . myViz . curInstr ,
1283- curline : args . myViz . curLineNumber ,
1284- prevline : args . myViz . prevLineNumber } ) ;
1286+ var obj = { type : 'updateOutput' , step : args . myViz . curInstr ,
1287+ curline : args . myViz . curLineNumber ,
1288+ prevline : args . myViz . prevLineNumber } ;
1289+ // optional field
1290+ if ( args . myViz . curLineExceptionMsg !== undefined ) {
1291+ obj . exception = args . myViz . curLineExceptionMsg ;
1292+ }
1293+ logEvent ( obj ) ;
12851294 } ) ;
12861295
12871296 // 2014-05-25: implemented more detailed tracing for surveys
@@ -1328,6 +1337,7 @@ function executePythonCode(pythonSourceCode,
13281337 backendDataJSON : JSON . stringify ( dataFromBackend ) , // for easier transport and compression
13291338 frontendOptionsObj : frontendOptionsObj ,
13301339 backendOptionsObj : backendOptionsObj ,
1340+ killerException : killerException , // if there's, say, a syntax error
13311341 } ) ;
13321342 }
13331343
0 commit comments