[GRASS-SVN] r49278 - grass-addons/grass7/raster/r.agent/libagent

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Nov 16 15:29:08 EST 2011


Author: mic
Date: 2011-11-16 12:29:07 -0800 (Wed, 16 Nov 2011)
New Revision: 49278

Modified:
   grass-addons/grass7/raster/r.agent/libagent/error.py
Log:
fix error handling

Modified: grass-addons/grass7/raster/r.agent/libagent/error.py
===================================================================
--- grass-addons/grass7/raster/r.agent/libagent/error.py	2011-11-16 18:00:48 UTC (rev 49277)
+++ grass-addons/grass7/raster/r.agent/libagent/error.py	2011-11-16 20:29:07 UTC (rev 49278)
@@ -12,12 +12,8 @@
 #############################################################################
 
 class Error(Exception):
-    """Base class for exceptions in this module."""
-    pass
+    """Base class for exceptions in this module.
 
-class DataError(Error):
-    """Exception raised for errors in the input.
-
     Attributes:
         expr -- Context expression in which the error occurred
         msg  -- explanation of the error
@@ -25,6 +21,23 @@
     def __init__(self, expr, msg):
         self.expr = expr
         self.msg = msg
-        print "DataError: " + expr + " " + msg
+    def __str__(self):
+        return self.expr + " '" + self.msg + "'"
 
+class EnvError(Error):
+    """Exception raised for missing GRASS environement.
 
+    Attributes:
+        expr -- Context expression in which the error occurred
+        msg  -- explanation of the error
+    """
+
+class DataError(Error):
+    """Exception raised for errors in the input.
+
+    Attributes:
+        expr -- Context expression in which the error occurred
+        msg  -- explanation of the error
+    """
+
+



More information about the grass-commit mailing list