瀏覽代碼

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 年之前
父節點
當前提交
8a4ab08226
共有 4 個文件被更改,包括 66 次插入31 次删除
  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",
 protocol: "services",
 fn: function (){
 fn: function (){
 var self=this,$self=this;
 var self=this,$self=this;
+var handler;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
 //>>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;
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"registerErrorHandler",{})});
+}, function($ctx1) {$ctx1.fill(self,"registerErrorHandler",{handler:handler})});
 //>>excludeEnd("ctx");
 //>>excludeEnd("ctx");
 },
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
 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"],
 referencedClasses: ["HLErrorHandler", "ErrorHandler"],
 //>>excludeEnd("ide");
 //>>excludeEnd("ide");
 pragmas: [],
 pragmas: [],
-messageSends: ["registerErrorHandler:", "environment", "new", "register:"]
+messageSends: ["new", "registerErrorHandler:", "environment", "register:"]
 }),
 }),
 $globals.HLManager);
 $globals.HLManager);
 
 

+ 4 - 2
src/Helios-Core.st

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

+ 41 - 11
src/Helios-Debugger.js

@@ -1632,7 +1632,7 @@ messageSends: ["initializeFromError:", "new", "yourself"]
 $globals.HLDebuggerModel.a$cls);
 $globals.HLDebuggerModel.a$cls);
 
 
 
 
-$core.addClass("HLErrorHandler", $globals.Object, [], "Helios-Debugger");
+$core.addClass("HLErrorHandler", $globals.Object, ["confirms"], "Helios-Debugger");
 $core.addMethod(
 $core.addMethod(
 $core.method({
 $core.method({
 selector: "confirmDebugError:",
 selector: "confirmDebugError:",
@@ -1642,21 +1642,31 @@ var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
 //>>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);
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
 //>>excludeEnd("ctx");
+$self.confirms=false;
 return $self._debugError_(anError);
 return $self._debugError_(anError);
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
 //>>excludeEnd("ctx");
 //>>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;
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"confirmDebugError:",{anError:anError})});
 }, function($ctx1) {$ctx1.fill(self,"confirmDebugError:",{anError:anError})});
@@ -1664,11 +1674,11 @@ return self;
 },
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["anError"],
 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"],
 referencedClasses: ["HLConfirmationWidget"],
 //>>excludeEnd("ide");
 //>>excludeEnd("ide");
 pragmas: [],
 pragmas: [],
-messageSends: ["confirmationString:", "new", "messageText", "actionBlock:", "debugError:", "cancelButtonLabel:", "confirmButtonLabel:", "show"]
+messageSends: ["ifFalse:", "confirmationString:", "new", "messageText", "cancelBlock:", "actionBlock:", "debugError:", "cancelButtonLabel:", "confirmButtonLabel:", "show"]
 }),
 }),
 $globals.HLErrorHandler);
 $globals.HLErrorHandler);
 
 
@@ -1738,6 +1748,26 @@ messageSends: ["confirmDebugError:"]
 }),
 }),
 $globals.HLErrorHandler);
 $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.addMethod(
 $core.method({
 $core.method({
 selector: "onErrorHandled",
 selector: "onErrorHandled",

+ 14 - 7
src/Helios-Debugger.st

@@ -421,18 +421,21 @@ on: anError
 ! !
 ! !
 
 
 Object subclass: #HLErrorHandler
 Object subclass: #HLErrorHandler
-	slots: {}
+	slots: {#confirms}
 	package: 'Helios-Debugger'!
 	package: 'Helios-Debugger'!
 
 
 !HLErrorHandler methodsFor: 'error handling'!
 !HLErrorHandler methodsFor: 'error handling'!
 
 
 confirmDebugError: anError
 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
 debugError: anError
@@ -448,6 +451,10 @@ handleError: anError
 	self confirmDebugError: anError
 	self confirmDebugError: anError
 !
 !
 
 
+initialize
+	confirms := false
+!
+
 onErrorHandled
 onErrorHandled
 	"when an error is handled, we need to make sure that
 	"when an error is handled, we need to make sure that
 	any progress bar widget gets removed. Because HLProgressBarWidget is asynchronous,
 	any progress bar widget gets removed. Because HLProgressBarWidget is asynchronous,