tools/spec: don't raise strings as exceptions
This commit is contained in:
parent
babd86aa2b
commit
e592afd8e0
@ -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'])
|
||||
|
Loading…
Reference in New Issue
Block a user