You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It means you should always inherit from StandardError, and NEVER from Exception. Inheriting from Exception is bad because it breaks the expected behavior of rescue. People will think they're rescuing all application-level errors but yours will just sail on through.
# Common ancestor for all error originating from Kaitai Struct usage.
# Stores KSY source path, pointing to an element supposedly guilty of
# an error.
classKaitaiStructError < Exception
But UnexpectedDataError should be left as is, because it only remains for compatibility with 0.8 and older KS versions (and will be eventually removed):
See https://www.honeybadger.io/blog/ruby-exception-vs-standarderror-whats-the-difference/#custom-exceptions-should-inherit-from-standarderror:
kaitai_struct_ruby_runtime/lib/kaitai/struct/struct.rb
Lines 688 to 692 in ecf6751
But
UnexpectedDataError
should be left as is, because it only remains for compatibility with 0.8 and older KS versions (and will be eventually removed):kaitai_struct_ruby_runtime/lib/kaitai/struct/struct.rb
Lines 78 to 84 in ecf6751
The text was updated successfully, but these errors were encountered: