Extended debugger to ignore exceptions occuring in lines having a '__IGNORE_EXCEPTION__' line flag set.

Fri, 09 Sep 2011 12:29:45 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 09 Sep 2011 12:29:45 +0200
changeset 1310
7fdcfa822e3e
parent 1309
6caa231421cf
child 1311
95685f9ad9f8

Extended debugger to ignore exceptions occuring in lines having a '__IGNORE_EXCEPTION__' line flag set.

Debugger/DebugUI.py file | annotate | diff | comparison | revisions
Helpviewer/Network/NetworkAccessManagerProxy.py file | annotate | diff | comparison | revisions
Helpviewer/UrlBar/UrlBar.py file | annotate | diff | comparison | revisions
PluginManager/PluginRepositoryDialog.py file | annotate | diff | comparison | revisions
UI/UserInterface.py file | annotate | diff | comparison | revisions
UtilitiesPython2/PySideImporter.py file | annotate | diff | comparison | revisions
changelog file | annotate | diff | comparison | revisions
eric5.py file | annotate | diff | comparison | revisions
eric5_configure.py file | annotate | diff | comparison | revisions
eric5_editor.py file | annotate | diff | comparison | revisions
eric5_webbrowser.py file | annotate | diff | comparison | revisions
--- a/Debugger/DebugUI.py	Fri Sep 09 12:00:59 2011 +0200
+++ b/Debugger/DebugUI.py	Fri Sep 09 12:29:45 2011 +0200
@@ -1016,37 +1016,49 @@
             (not len(self.excList) or \
             (len(self.excList) and exceptionType in self.excList)))\
            or exceptionType.startswith('unhandled'):
+            res = None
             if stackTrace:
-                self.viewmanager.setFileLine(stackTrace[0][0], stackTrace[0][1], True)
-            if Preferences.getDebugger("BreakAlways"):
-                res = E5MessageBox.Yes
-            else:
-                if stackTrace:
-                    if exceptionType.startswith('unhandled'):
-                        buttons = E5MessageBox.StandardButtons(
-                            E5MessageBox.No | \
-                            E5MessageBox.Yes)
+                try:
+                    file, line = stackTrace[0]
+                    source, encoding = Utilities.readEncodedFile(file)
+                    source = source.splitlines(True)
+                    if "__IGNORE_EXCEPTION__" in Utilities.extractLineFlags(
+                            source[line - 1]):
+                        res = E5MessageBox.No
+                except (UnicodeError, IOError):
+                    pass
+                if res != E5MessageBox.No:
+                    self.viewmanager.setFileLine(stackTrace[0][0], stackTrace[0][1], True)
+            if res != E5MessageBox.No:
+                if Preferences.getDebugger("BreakAlways"):
+                    res = E5MessageBox.Yes
+                else:
+                    if stackTrace:
+                        if exceptionType.startswith('unhandled'):
+                            buttons = E5MessageBox.StandardButtons(
+                                E5MessageBox.No | \
+                                E5MessageBox.Yes)
+                        else:
+                            buttons = E5MessageBox.StandardButtons(
+                                E5MessageBox.No | \
+                                E5MessageBox.Yes | \
+                                E5MessageBox.Ignore)
+                        res = E5MessageBox.critical(self.ui, Program,
+                            self.trUtf8('<p>The debugged program raised the exception'
+                                        ' <b>{0}</b><br>"<b>{1}</b>"<br>File: <b>{2}</b>,'
+                                        ' Line: <b>{3}</b></p><p>Break here?</p>')
+                                .format(exceptionType,
+                                        Utilities.html_encode(exceptionMessage),
+                                        stackTrace[0][0],
+                                        stackTrace[0][1]),
+                            buttons,
+                            E5MessageBox.No)
                     else:
-                        buttons = E5MessageBox.StandardButtons(
-                            E5MessageBox.No | \
-                            E5MessageBox.Yes | \
-                            E5MessageBox.Ignore)
-                    res = E5MessageBox.critical(self.ui, Program,
-                        self.trUtf8('<p>The debugged program raised the exception'
-                                    ' <b>{0}</b><br>"<b>{1}</b>"<br>File: <b>{2}</b>,'
-                                    ' Line: <b>{3}</b></p><p>Break here?</p>')
-                            .format(exceptionType,
-                                    Utilities.html_encode(exceptionMessage),
-                                    stackTrace[0][0],
-                                    stackTrace[0][1]),
-                        buttons,
-                        E5MessageBox.No)
-                else:
-                    res = E5MessageBox.critical(self.ui, Program,
-                        self.trUtf8('<p>The debugged program raised the exception'
-                                    ' <b>{0}</b><br>"<b>{1}</b>"</p>')
-                            .format(exceptionType,
-                                    Utilities.html_encode(exceptionMessage)))
+                        res = E5MessageBox.critical(self.ui, Program,
+                            self.trUtf8('<p>The debugged program raised the exception'
+                                        ' <b>{0}</b><br>"<b>{1}</b>"</p>')
+                                .format(exceptionType,
+                                        Utilities.html_encode(exceptionMessage)))
             if res == E5MessageBox.Yes:
                 self.exceptionInterrupt.emit()
                 stack = []
--- a/Helpviewer/Network/NetworkAccessManagerProxy.py	Fri Sep 09 12:00:59 2011 +0200
+++ b/Helpviewer/Network/NetworkAccessManagerProxy.py	Fri Sep 09 12:29:45 2011 +0200
@@ -9,7 +9,7 @@
 
 from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest
 try:
-    from PyQt4.QtNetwork import QSslError   # __IGNORE_WARNING__
+    from PyQt4.QtNetwork import QSslError   # __IGNORE_EXCEPTION__ __IGNORE_WARNING__
     SSL_AVAILABLE = True
 except ImportError:
     SSL_AVAILABLE = False
--- a/Helpviewer/UrlBar/UrlBar.py	Fri Sep 09 12:00:59 2011 +0200
+++ b/Helpviewer/UrlBar/UrlBar.py	Fri Sep 09 12:29:45 2011 +0200
@@ -10,7 +10,7 @@
 from PyQt4.QtCore import pyqtSlot, Qt, QPointF, QUrl
 from PyQt4.QtGui import QColor, QPalette, QApplication, QLinearGradient, QIcon
 try:
-    from PyQt4.QtNetwork import QSslCertificate
+    from PyQt4.QtNetwork import QSslCertificate     # __IGNORE_EXCEPTION__
 except ImportError:
     QSslCertificate = None      # __IGNORE_WARNING__
 from PyQt4.QtWebKit import QWebSettings, QWebPage
--- a/PluginManager/PluginRepositoryDialog.py	Fri Sep 09 12:00:59 2011 +0200
+++ b/PluginManager/PluginRepositoryDialog.py	Fri Sep 09 12:29:45 2011 +0200
@@ -17,7 +17,7 @@
     QDialog, QVBoxLayout, QMainWindow
 from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply
 try:
-    from PyQt4.QtNetwork import QSslError   # __IGNORE_WARNING__
+    from PyQt4.QtNetwork import QSslError   # __IGNORE_EXCEPTION__ __IGNORE_WARNING__
     SSL_AVAILABLE = True
 except ImportError:
     SSL_AVAILABLE = False
--- a/UI/UserInterface.py	Fri Sep 09 12:00:59 2011 +0200
+++ b/UI/UserInterface.py	Fri Sep 09 12:29:45 2011 +0200
@@ -20,7 +20,7 @@
 from PyQt4.QtNetwork import QNetworkProxyFactory, QNetworkAccessManager, \
     QNetworkRequest, QNetworkReply
 try:
-    from PyQt4.QtNetwork import QSslError   # __IGNORE_WARNING__
+    from PyQt4.QtNetwork import QSslError   # __IGNORE_EXCEPTION__ __IGNORE_WARNING__
     SSL_AVAILABLE = True
 except ImportError:
     SSL_AVAILABLE = False
--- a/UtilitiesPython2/PySideImporter.py	Fri Sep 09 12:00:59 2011 +0200
+++ b/UtilitiesPython2/PySideImporter.py	Fri Sep 09 12:29:45 2011 +0200
@@ -11,7 +11,7 @@
 
 if __name__ == "__main__":
     try:
-        import PySide       # __IGNORE_WARNING__
+        import PySide       # __IGNORE_EXCEPTION__ __IGNORE_WARNING__
         ret = 0
     except ImportError:
         ret = 1
--- a/changelog	Fri Sep 09 12:00:59 2011 +0200
+++ b/changelog	Fri Sep 09 12:29:45 2011 +0200
@@ -2,6 +2,10 @@
 ----------
 Version 5.2-snapshot-2011mmdd:
 - bug fixes
+- enhancements of the debugger
+  -- extended debugger to show class variables
+  -- extended debugger to ignore exceptions occuring in lines having a
+     '__IGNORE_EXCEPTION__' line flag set
 - enhancements of the editor
   -- added an action to preview the file in the eric web browser. File name
      extension to support this feature can be configured on the
--- a/eric5.py	Fri Sep 09 12:00:59 2011 +0200
+++ b/eric5.py	Fri Sep 09 12:29:45 2011 +0200
@@ -44,7 +44,7 @@
 
 # make Third-Party package available as a packages repository
 try:
-    import pygments     # __IGNORE_WARNING__
+    import pygments     # __IGNORE_EXCEPTION__ __IGNORE_WARNING__
 except ImportError:
     sys.path.insert(2, os.path.join(os.path.dirname(__file__), "ThirdParty", "Pygments"))
 
--- a/eric5_configure.py	Fri Sep 09 12:00:59 2011 +0200
+++ b/eric5_configure.py	Fri Sep 09 12:29:45 2011 +0200
@@ -23,7 +23,7 @@
 
 # make ThirdParty package available as a packages repository
 try:
-    import pygments     # __IGNORE_WARNING__
+    import pygments     # __IGNORE_EXCEPTION__ __IGNORE_WARNING__
 except ImportError:
     sys.path.insert(2, os.path.join(os.path.dirname(__file__), "ThirdParty", "Pygments"))
 
--- a/eric5_editor.py	Fri Sep 09 12:00:59 2011 +0200
+++ b/eric5_editor.py	Fri Sep 09 12:29:45 2011 +0200
@@ -25,7 +25,7 @@
 
 # make ThirdParty package available as a packages repository
 try:
-    import pygments     # __IGNORE_WARNING__
+    import pygments     # __IGNORE_EXCEPTION__ __IGNORE_WARNING__
 except ImportError:
     sys.path.insert(2, os.path.join(os.path.dirname(__file__), "ThirdParty", "Pygments"))
 
--- a/eric5_webbrowser.py	Fri Sep 09 12:00:59 2011 +0200
+++ b/eric5_webbrowser.py	Fri Sep 09 12:29:45 2011 +0200
@@ -25,7 +25,7 @@
 
 # make ThirdParty package available as a packages repository
 try:
-    import pygments     # __IGNORE_WARNING__
+    import pygments     # __IGNORE_EXCEPTION__ __IGNORE_WARNING__
 except ImportError:
     sys.path.insert(2, os.path.join(os.path.dirname(__file__), "ThirdParty", "Pygments"))
 

eric ide

mercurial