Skip to content

Commit b5d9b98

Browse files
committed
Add ValidationNotInEnumError
See kaitai-io/kaitai_struct#435 (comment)
1 parent 9bdaeb3 commit b5d9b98

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

kaitaistruct.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,15 @@ def __init__(self, actual, io, src_path):
906906
self.actual = actual
907907

908908

909+
class ValidationNotInEnumError(ValidationFailedError):
910+
"""Signals validation failure: we required "actual" value to be in
911+
the enum, but it turned out that it's not.
912+
"""
913+
def __init__(self, actual, io, src_path):
914+
super(ValidationNotInEnumError, self).__init__("not in the enum, got %s" % (repr(actual)), io, src_path)
915+
self.actual = actual
916+
917+
909918
class ValidationExprError(ValidationFailedError):
910919
"""Signals validation failure: we required "actual" value to match
911920
the expression, but it turned out that it doesn't.

0 commit comments

Comments
 (0)