Skip to content

Commit

Permalink
Validation*Error: only include "at pos X: " if io is not None
Browse files Browse the repository at this point in the history
  • Loading branch information
generalmimon committed Sep 25, 2023
1 parent 704995a commit c0c454b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kaitaistruct.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ class ValidationFailedError(KaitaiStructError):
KaitaiStream IO object which was involved in an error.
"""
def __init__(self, msg, io, src_path):
super(ValidationFailedError, self).__init__("at pos %d: validation failed: %s" % (io.pos(), msg), src_path)
super(ValidationFailedError, self).__init__(("" if io is None else "at pos %d: " % (io.pos(),)) + "validation failed: " + msg, src_path)
self.io = io


Expand Down

0 comments on commit c0c454b

Please sign in to comment.