Browse Source

Debugger: give ctx-less errors last-minute ctx.

Herby Vojčík 4 years ago
parent
commit
4a135e2dac
2 changed files with 14 additions and 8 deletions
  1. 10 3
      src/Helios-Debugger.js
  2. 4 5
      src/Helios-Debugger.st

+ 10 - 3
src/Helios-Debugger.js

@@ -1691,10 +1691,17 @@ var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
+var $1,$receiver;
 $recv((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
+$1=$recv(anError)._context();
+if(($receiver = $1) == null || $receiver.a$nil){
+$recv(anError)._context_($core.getThisContext());
+} else {
+$1;
+}
 return $recv($recv($globals.HLDebugger)._on_(anError))._openAsTab();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
@@ -1705,7 +1712,7 @@ return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
 return $recv($recv($globals.ConsoleErrorHandler)._new())._handleError_(error);
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
+}, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,3)});
 //>>excludeEnd("ctx");
 }));
 return self;
@@ -1715,11 +1722,11 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["anError"],
-source: "debugError: anError\x0a\x0a\x09[ \x0a\x09\x09(HLDebugger on: anError) openAsTab \x0a\x09] \x0a\x09\x09on: Error \x0a\x09\x09do: [ :error | ConsoleErrorHandler new handleError: error ]",
+source: "debugError: anError\x0a\x0a\x09[\x0a\x09\x09anError context ifNil: [ anError context: thisContext ].\x0a\x09\x09(HLDebugger on: anError) openAsTab ]\x0a\x09on: Error do: [ :error | ConsoleErrorHandler new handleError: error ]",
 referencedClasses: ["HLDebugger", "Error", "ConsoleErrorHandler"],
 //>>excludeEnd("ide");
 pragmas: [],
-messageSends: ["on:do:", "openAsTab", "on:", "handleError:", "new"]
+messageSends: ["on:do:", "ifNil:", "context", "context:", "openAsTab", "on:", "handleError:", "new"]
 }),
 $globals.HLErrorHandler);
 

+ 4 - 5
src/Helios-Debugger.st

@@ -440,11 +440,10 @@ confirmDebugError: anError
 
 debugError: anError
 
-	[ 
-		(HLDebugger on: anError) openAsTab 
-	] 
-		on: Error 
-		do: [ :error | ConsoleErrorHandler new handleError: error ]
+	[
+		anError context ifNil: [ anError context: thisContext ].
+		(HLDebugger on: anError) openAsTab ]
+	on: Error do: [ :error | ConsoleErrorHandler new handleError: error ]
 !
 
 handleError: anError