Browse Source

Only show first debug error.

If others appear while first is confumed via dialog,
ignore them. They are likely secondary to the first
which is the root cause.
Herby Vojčík 4 years ago
parent
commit
8a4ab08226
4 changed files with 66 additions and 31 deletions
  1. 7 11
      src/Helios-Core.js
  2. 4 2
      src/Helios-Core.st
  3. 41 11
      src/Helios-Debugger.js
  4. 14 7
      src/Helios-Debugger.st

+ 7 - 11
src/Helios-Core.js

@@ -5648,29 +5648,25 @@ selector: "registerErrorHandler",
 protocol: "services",
 fn: function (){
 var self=this,$self=this;
+var handler;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-var $1,$2;
-$1=$self._environment();
-$2=$recv($globals.HLErrorHandler)._new();
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.sendIdx["new"]=1;
-//>>excludeEnd("ctx");
-$recv($1)._registerErrorHandler_($2);
-$recv($globals.ErrorHandler)._register_($recv($globals.HLErrorHandler)._new());
+handler=$recv($globals.HLErrorHandler)._new();
+$recv($self._environment())._registerErrorHandler_(handler);
+$recv($globals.ErrorHandler)._register_(handler);
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"registerErrorHandler",{})});
+}, function($ctx1) {$ctx1.fill(self,"registerErrorHandler",{handler:handler})});
 //>>excludeEnd("ctx");
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-source: "registerErrorHandler\x0a\x09self environment registerErrorHandler: HLErrorHandler new.\x0a\x09ErrorHandler register: HLErrorHandler new",
+source: "registerErrorHandler\x0a\x09| handler |\x0a\x09handler := HLErrorHandler new.\x0a\x09self environment registerErrorHandler: handler.\x0a\x09ErrorHandler register: handler",
 referencedClasses: ["HLErrorHandler", "ErrorHandler"],
 //>>excludeEnd("ide");
 pragmas: [],
-messageSends: ["registerErrorHandler:", "environment", "new", "register:"]
+messageSends: ["new", "registerErrorHandler:", "environment", "register:"]
 }),
 $globals.HLManager);
 

+ 4 - 2
src/Helios-Core.st

@@ -1403,8 +1403,10 @@ renderDefaultTabs
 !HLManager methodsFor: 'services'!
 
 registerErrorHandler
-	self environment registerErrorHandler: HLErrorHandler new.
-	ErrorHandler register: HLErrorHandler new
+	| handler |
+	handler := HLErrorHandler new.
+	self environment registerErrorHandler: handler.
+	ErrorHandler register: handler
 !
 
 registerFinder

+ 41 - 11
src/Helios-Debugger.js

@@ -1632,7 +1632,7 @@ messageSends: ["initializeFromError:", "new", "yourself"]
 $globals.HLDebuggerModel.a$cls);
 
 
-$core.addClass("HLErrorHandler", $globals.Object, [], "Helios-Debugger");
+$core.addClass("HLErrorHandler", $globals.Object, ["confirms"], "Helios-Debugger");
 $core.addMethod(
 $core.method({
 selector: "confirmDebugError:",
@@ -1642,21 +1642,31 @@ var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-var $1;
-$1=$recv($globals.HLConfirmationWidget)._new();
-$recv($1)._confirmationString_($recv(anError)._messageText());
-$recv($1)._actionBlock_((function(){
+var $1,$2;
+$1=$self.confirms;
+if(!$core.assert($1)){
+$self.confirms=true;
+$2=$recv($globals.HLConfirmationWidget)._new();
+$recv($2)._confirmationString_($recv(anError)._messageText());
+$recv($2)._cancelBlock_((function(){
+$self.confirms=false;
+return $self.confirms;
+
+}));
+$recv($2)._actionBlock_((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
+$self.confirms=false;
 return $self._debugError_(anError);
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
 //>>excludeEnd("ctx");
 }));
-$recv($1)._cancelButtonLabel_("Abandon");
-$recv($1)._confirmButtonLabel_("Debug");
-$recv($1)._show();
+$recv($2)._cancelButtonLabel_("Abandon");
+$recv($2)._confirmButtonLabel_("Debug");
+$recv($2)._show();
+}
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"confirmDebugError:",{anError:anError})});
@@ -1664,11 +1674,11 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["anError"],
-source: "confirmDebugError: anError\x0a\x09HLConfirmationWidget new\x0a\x09\x09confirmationString: anError messageText;\x0a\x09\x09actionBlock: [ self debugError: anError ];\x0a\x09\x09cancelButtonLabel: 'Abandon';\x0a\x09\x09confirmButtonLabel: 'Debug';\x0a\x09\x09show",
+source: "confirmDebugError: anError\x0a\x09confirms ifFalse: [\x0a\x09\x09confirms := true.\x0a\x09\x09HLConfirmationWidget new\x0a\x09\x09\x09confirmationString: anError messageText;\x0a\x09\x09\x09cancelBlock: [ confirms := false ];\x0a\x09\x09\x09actionBlock: [ confirms := false. self debugError: anError ];\x0a\x09\x09\x09cancelButtonLabel: 'Abandon';\x0a\x09\x09\x09confirmButtonLabel: 'Debug';\x0a\x09\x09\x09show ]",
 referencedClasses: ["HLConfirmationWidget"],
 //>>excludeEnd("ide");
 pragmas: [],
-messageSends: ["confirmationString:", "new", "messageText", "actionBlock:", "debugError:", "cancelButtonLabel:", "confirmButtonLabel:", "show"]
+messageSends: ["ifFalse:", "confirmationString:", "new", "messageText", "cancelBlock:", "actionBlock:", "debugError:", "cancelButtonLabel:", "confirmButtonLabel:", "show"]
 }),
 $globals.HLErrorHandler);
 
@@ -1738,6 +1748,26 @@ messageSends: ["confirmDebugError:"]
 }),
 $globals.HLErrorHandler);
 
+$core.addMethod(
+$core.method({
+selector: "initialize",
+protocol: "error handling",
+fn: function (){
+var self=this,$self=this;
+$self.confirms=false;
+return self;
+
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "initialize\x0a\x09confirms := false",
+referencedClasses: [],
+//>>excludeEnd("ide");
+pragmas: [],
+messageSends: []
+}),
+$globals.HLErrorHandler);
+
 $core.addMethod(
 $core.method({
 selector: "onErrorHandled",

+ 14 - 7
src/Helios-Debugger.st

@@ -421,18 +421,21 @@ on: anError
 ! !
 
 Object subclass: #HLErrorHandler
-	slots: {}
+	slots: {#confirms}
 	package: 'Helios-Debugger'!
 
 !HLErrorHandler methodsFor: 'error handling'!
 
 confirmDebugError: anError
-	HLConfirmationWidget new
-		confirmationString: anError messageText;
-		actionBlock: [ self debugError: anError ];
-		cancelButtonLabel: 'Abandon';
-		confirmButtonLabel: 'Debug';
-		show
+	confirms ifFalse: [
+		confirms := true.
+		HLConfirmationWidget new
+			confirmationString: anError messageText;
+			cancelBlock: [ confirms := false ];
+			actionBlock: [ confirms := false. self debugError: anError ];
+			cancelButtonLabel: 'Abandon';
+			confirmButtonLabel: 'Debug';
+			show ]
 !
 
 debugError: anError
@@ -448,6 +451,10 @@ handleError: anError
 	self confirmDebugError: anError
 !
 
+initialize
+	confirms := false
+!
+
 onErrorHandled
 	"when an error is handled, we need to make sure that
 	any progress bar widget gets removed. Because HLProgressBarWidget is asynchronous,