Add a parse error exception, and use that for unparsed lines rather than exiting...
authorChris Larson <clarson@kergoth.com>
Wed, 31 Mar 2004 18:14:27 +0000 (18:14 +0000)
committerChris Larson <clarson@kergoth.com>
Wed, 31 Mar 2004 18:14:27 +0000 (18:14 +0000)
bin/oe/parse/ConfHandler.py
bin/oe/parse/__init__.py

index b709972..15f85ed 100644 (file)
@@ -151,7 +151,7 @@ def feeder(lineno, s, fn, data = {}):
                include(fn, s, data)
                return
 
-       fatal("PARSER: %s:%d: unparsed line" % (fn, lineno));
+       raise ParseError("%s:%d: unparsed line" % (fn, lineno));
 
 # Add us to the handlers list
 from oe.parse import handlers
index 1871c2a..9128edf 100644 (file)
@@ -10,12 +10,18 @@ Based on functions from the base oe module, Copyright 2003 Holger Schurig
 """
 __version__ = '1.0'
 
-__all__ = [ 'handlers', 'supports', 'handle', 'init' ]
+__all__ = [ 'handlers', 'supports', 'handle', 'init', 'ConfHandler', 'OEHandler', 'SRPMHandler', 'ParseError' ]
 handlers = []
 
+class ParseError(Exception):
+       """Exception raised when parsing fails"""
+
 import ConfHandler
+ConfHandler.ParseError = ParseError
 import OEHandler
+OEHandler.ParseError = ParseError
 import SRPMHandler
+SRPMHandler.ParseError = ParseError
 
 def supports(fn, data):
        """Returns true if we have a handler for this file, false otherwise"""