Browse Source

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

Herby Vojčík 4 years ago
parent
commit
93b489a871
2 changed files with 17 additions and 11 deletions
  1. 13 7
      src/IDE.js
  2. 4 4
      src/IDE.st

+ 13 - 7
src/IDE.js

@@ -399,17 +399,23 @@ var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-var $1;
+var $1,$2,$receiver;
 $recv((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
-$1=$recv($globals.Debugger)._new();
+$1=$recv(anError)._context();
+if(($receiver = $1) == null || $receiver.a$nil){
+$recv(anError)._context_($core.getThisContext());
+} else {
+$1;
+}
+$2=$recv($globals.Debugger)._new();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx2.sendIdx["new"]=1;
 //>>excludeEnd("ctx");
-$recv($1)._error_(anError);
-return $recv($1)._open();
+$recv($2)._error_(anError);
+return $recv($2)._open();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
 //>>excludeEnd("ctx");
@@ -419,7 +425,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;
@@ -429,11 +435,11 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["anError"],
-source: "handleError: anError\x0a\x09[ Debugger new\x0a\x09\x09error: anError;\x0a\x09\x09open ] on: Error do: [ :error |\x0a\x09\x09\x09ConsoleErrorHandler new handleError: error ]",
+source: "handleError: anError\x0a\x09[\x0a\x09\x09anError context ifNil: [ anError context: thisContext ].\x0a\x09\x09Debugger new error: anError; open ]\x0a\x09on: Error do: [ :error | ConsoleErrorHandler new handleError: error ]",
 referencedClasses: ["Debugger", "Error", "ConsoleErrorHandler"],
 //>>excludeEnd("ide");
 pragmas: [],
-messageSends: ["on:do:", "error:", "new", "open", "handleError:"]
+messageSends: ["on:do:", "ifNil:", "context", "context:", "error:", "new", "open", "handleError:"]
 }),
 $globals.DebugErrorHandler);
 

+ 4 - 4
src/IDE.st

@@ -91,10 +91,10 @@ Object subclass: #DebugErrorHandler
 !DebugErrorHandler methodsFor: 'error handling'!
 
 handleError: anError
-	[ Debugger new
-		error: anError;
-		open ] on: Error do: [ :error |
-			ConsoleErrorHandler new handleError: error ]
+	[
+		anError context ifNil: [ anError context: thisContext ].
+		Debugger new error: anError; open ]
+	on: Error do: [ :error | ConsoleErrorHandler new handleError: error ]
 ! !
 
 !DebugErrorHandler class methodsFor: 'initialization'!