Skip to content

Commit 2d7be4b

Browse files
committed
change groups not to raise an exception when one is not supported
1 parent f76b828 commit 2d7be4b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/qbindiff/loader/types.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616
"""
1717

1818
from __future__ import annotations
19+
20+
import logging
1921
from enum import IntEnum, IntFlag, auto
2022
from typing import TypeAlias, TYPE_CHECKING
2123
import enum_tools.documentation
2224

25+
from qbindiff.utils import log_once
26+
2327
if TYPE_CHECKING:
2428
from qbindiff.loader.data import Data
2529
from qbindiff.loader.structure import Structure, StructureMember
@@ -143,10 +147,11 @@ def from_capstone(cls, capstone_group: int):
143147
try:
144148
return InstructionGroup(capstone_group)
145149
except ValueError:
146-
# Raise an exception if cast is not possible
147-
raise ValueError(
148-
f"Misalignment between capstone group {capstone_group} and InstructionGroup"
150+
# Log once the unsupported
151+
log_once(logging.WARN,
152+
f"Misalignment between capstone group {capstone_group} and InstructionGroup"
149153
)
154+
return InstructionGroup.GRP_INVALID
150155

151156

152157
@enum_tools.documentation.document_enum

0 commit comments

Comments
 (0)