When debugging, open a debugger on a process that actually raised (propagated:) the exception.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Thu, 17 Jul 2014 08:28:53 +0000
changeset 447 73e53f58ae31
parent 446 35a8e7b3ad1e
child 448 a89dd6b4acc8
When debugging, open a debugger on a process that actually raised (propagated:) the exception. This ease debugging og command execution. User may inspect the state of the program at the point when the error occured rather than some time later when error is propagated to the caller and thus stack and other interesting state is gone. However, errors MUST be propagated to the caller so the caller may catch them even if they actually occured in a separated process launched by HGCommand (which is considered as an implementation detail the caller should not need to know)
mercurial/HGCommand.st
--- a/mercurial/HGCommand.st	Thu Jul 17 06:52:13 2014 +0000
+++ b/mercurial/HGCommand.st	Thu Jul 17 08:28:53 2014 +0000
@@ -640,16 +640,22 @@
         Logger log: 'cmd: propagating: ' , anException class name , ' - ', anException description severity: #trace facility: 'HG'.
     ].
     Debug ifTrue:[
-    	anException isNotification ifFalse:[
+        anException isNotification ifFalse:[
+            | wasResumable |  
+
             anException suspendedContext notNil ifTrue:[
                 anException suspendedContext fullPrintAllOn: Transcript.
             ].
+            "/ When debugging, open a debugger here so the user may check the 
+            "/ stack and actual variable values in debugger.
+            Debugger enter.
         ].
     ].
     errors nextPut: anException.
 
     "Created: / 04-02-2013 / 21:29:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 05-03-2014 / 00:08:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 17-07-2014 / 08:21:15 / jv"
 !
 
 signal
@@ -913,7 +919,9 @@
         Trace ifTrue:[
             Logger log: 'cmd: worker ''', name , ''' spawned' severity: #trace facility: 'HG'.
         ].
-        block on: Error do:[:ex|self propagate:ex]
+        block on: Error do:[:ex|
+            self propagate:ex
+        ]
     ] newProcess.
     worker addExitAction:[
         Trace ifTrue:[
@@ -927,6 +935,7 @@
 
     "Created: / 03-03-2013 / 16:56:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 05-03-2013 / 19:42:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (format): / 17-07-2014 / 07:31:58 / jv"
 !
 
 spawnErrorReaderOn: stderr