浏览代码

pythonlib: do not raise on error by default

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@44112 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 14 年之前
父节点
当前提交
9765912427
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      lib/python/core.py

+ 3 - 2
lib/python/core.py

@@ -62,7 +62,7 @@ class ScriptException(Exception):
     def __str__(self):
         return repr(self.value)
         
-raise_on_error = True  # raise exception instead of calling fatal()
+raise_on_error = False # raise exception instead of calling fatal()
 debug_level = 0        # DEBUG level
 
 def call(*args, **kwargs):
@@ -349,6 +349,7 @@ def error(msg):
     
     @param msg error message to be displayed
     """
+    global raise_on_error
     if raise_on_error:
         raise ScriptException(msg)
     else:
@@ -362,7 +363,7 @@ def fatal(msg):
     error(msg)
     sys.exit(1)
     
-def raise_on_error(raise_exp = True):
+def set_raise_on_error(raise_exp = True):
     """!Define behaviour on error (error() called)
 
     @param raise_exp True to raise ScriptException instead of calling error()