mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-05-08 17:28:44 +02:00
scanner: make the invalid type message a bit easier to identify
This commit is contained in:
parent
34889d4803
commit
f6cfe9803c
1 changed files with 16 additions and 3 deletions
|
|
@ -112,8 +112,9 @@ class Argument:
|
|||
|
||||
@signature.validator # type: ignore
|
||||
def _validate_signature(self, attribute, value):
|
||||
types = "iufhnos"
|
||||
assert value in types, f"Failed to parse signature {value}"
|
||||
assert (
|
||||
value is not None and value in "iufhnos"
|
||||
), f"Failed to parse signature {value}"
|
||||
|
||||
@classmethod
|
||||
def create(
|
||||
|
|
@ -124,7 +125,13 @@ class Argument:
|
|||
enum: Optional["Enum"] = None,
|
||||
interface: Optional["Interface"] = None,
|
||||
) -> "Argument":
|
||||
return cls(name, signature, summary, enum, interface=interface)
|
||||
return cls(
|
||||
name=name,
|
||||
signature=signature,
|
||||
summary=summary,
|
||||
enum=enum,
|
||||
interface=interface,
|
||||
)
|
||||
|
||||
|
||||
@attr.s
|
||||
|
|
@ -499,6 +506,12 @@ class Protocol(xml.sax.handler.ContentHandler):
|
|||
)
|
||||
name = attrs["name"]
|
||||
sig = attrs["type"]
|
||||
if proto_to_type(sig) is None:
|
||||
raise XmlError(
|
||||
*self.location,
|
||||
f"Invalid type '{sig}' for '{self.current_interface.name}.{self.current_message.name}::{name}'",
|
||||
)
|
||||
|
||||
summary = attrs.get("summary", "")
|
||||
interface_name = attrs.get("interface", None)
|
||||
if interface_name is not None:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue