Skip to content

Commit

Permalink
change groups not to raise an exception when one is not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinDavid committed Nov 28, 2024
1 parent f76b828 commit 2d7be4b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/qbindiff/loader/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@
"""

from __future__ import annotations

import logging
from enum import IntEnum, IntFlag, auto
from typing import TypeAlias, TYPE_CHECKING
import enum_tools.documentation

from qbindiff.utils import log_once

if TYPE_CHECKING:
from qbindiff.loader.data import Data
from qbindiff.loader.structure import Structure, StructureMember
Expand Down Expand Up @@ -143,10 +147,11 @@ def from_capstone(cls, capstone_group: int):
try:
return InstructionGroup(capstone_group)
except ValueError:
# Raise an exception if cast is not possible
raise ValueError(
f"Misalignment between capstone group {capstone_group} and InstructionGroup"
# Log once the unsupported
log_once(logging.WARN,
f"Misalignment between capstone group {capstone_group} and InstructionGroup"
)
return InstructionGroup.GRP_INVALID


@enum_tools.documentation.document_enum
Expand Down

0 comments on commit 2d7be4b

Please sign in to comment.