def finish(me):
pass
+class ExpectedError (Exception): pass
+
###--------------------------------------------------------------------------
### A bulk DNS resolver.
-class ResolverFailure (Exception):
+class ResolverFailure (ExpectedError):
def __init__(me, host, msg):
me.host = host
me.msg = msg
## Match a $[HOST] name resolution reference; group 1 is the HOST.
RX_RESOLVE = RX.compile(r'(?x) \$ \[ ([^]]+) \]')
-class ConfigSyntaxError (Exception):
+class ConfigSyntaxError (ExpectedError):
def __init__(me, fname, lno, msg):
me.fname = fname
me.lno = lno
def _fmt_path(path):
return ' -> '.join(["`%s'" % hop for hop in path])
-class AmbiguousOptionError (Exception):
+class AmbiguousOptionError (ExpectedError):
def __init__(me, key, patha, vala, pathb, valb):
me.key = key
me.patha, me.vala = patha, vala
"path %s yields `%s' but %s yields `%s'" % \
(me.key, _fmt_path(me.patha), me.vala, _fmt_path(me.pathb), me.valb)
-class InheritanceCycleError (Exception):
+class InheritanceCycleError (ExpectedError):
def __init__(me, key, path):
me.key = key
me.path = path
return "Found a cycle %s looking up key `%s'" % \
(_fmt_path(me.path), me.key)
-class MissingSectionException (Exception):
+class MissingSectionException (ExpectedError):
def __init__(me, sec):
me.key = key
def __str__(me):
return "Section `%s' not found" % (me.sec)
-class MissingKeyException (Exception):
+class MissingKeyException (ExpectedError):
def __init__(me, sec, key):
me.sec = sec
me.key = key
cdb = CDB.cdbmake(opts.cdbfile, opts.cdbfile + '.new')
else:
cdb = CDBFake()
- conf = getconf(args[1:])
- output(conf, cdb)
+ try:
+ conf = getconf(args[1:])
+ output(conf, cdb)
+ except ExpectedError, e:
+ M.moan(str(e))
+ exit(2)
if __name__ == '__main__':
main()