From e592afd8e0d74a2300d2437a320f63f0b217a629 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Sat, 5 Jan 2019 12:29:35 +1100 Subject: [PATCH] tools/spec: don't raise strings as exceptions --- tools/spec.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/spec.py b/tools/spec.py index bc477f1..7156665 100644 --- a/tools/spec.py +++ b/tools/spec.py @@ -401,7 +401,7 @@ class Constant(Type): elif 'bitpos' in node.attrib: self.value = "1 << %s" % node.attrib['bitpos'] else: - raise "Unknown constant value type" + raise RuntimeError("Unknown constant value type") def declare(self): return "constexpr auto %(name)s = %(value)s;" % { @@ -497,7 +497,7 @@ class Require(object): elif node.tag in ['comment']: pass else: - raise "Unknown requires node" + raise RuntimeError("Unknown requires node") def apply(self, reg: Registry, extnumber=None): required = [] @@ -528,7 +528,7 @@ class Require(object): elif value.tag == 'command': required.append(name) else: - raise "Unknown type" + raise RuntimeError("Unknown type") return required @@ -545,7 +545,7 @@ class Feature(Type): if 'require' == node.tag: self.requires.append(Require(node)) else: - raise "Unhandled feature node" + raise RuntimeError("Unhandled feature node") def define(self, reg: Registry): return "#define %s" % self.name @@ -579,7 +579,7 @@ class Extension(Type): if node.tag == 'require': self.requires.append(Require(node)) else: - raise "Unknown extension node" + raise RuntimeError("Unknown extension node") def apply(self, reg: Registry, platform: Set[str]): if self.name in reg.applied: @@ -653,7 +653,7 @@ def parse_types(reg: Registry, root): if concrete: reg.types[name] = concrete(t) else: - raise 'unhandled type' + raise RuntimeError('unhandled type') if 'requires' in t.attrib: reg.types[name].depends.append(t.attrib['requires'])