Permalink
Browse files

ignore unknown header types

  • Loading branch information...
1 parent 4f2b529 commit 5834d77acec0f181e306c8ba7fe5ebe8a33ea547 @mephux committed Dec 12, 2011
View
@@ -148,6 +148,11 @@ def self.watch(path, position=:first, &block)
end
end
+ rescue UnknownHeaderType, IndexError, Errno::EINVAL, IOError
+ position = 0 unless position.is_a?(Integer)
+ io.sysseek(position += 1, IO::SEEK_CUR)
+ @event, event = nil
+ retry
rescue RuntimeError
raise(BinaryReadError, "incorrect file format or position seek error")
rescue Interrupt
@@ -107,7 +107,7 @@ def type_selection
# define UNIFIED2_EXTRA_DATA 110
"extra_data"
else
- raise "unknown type #{header.u2type}"
+ raise(UnknownHeaderType, "unknown type #{header.u2type}")
end
end
@@ -1,3 +1,5 @@
require 'unified2/exceptions/file_not_found'
require 'unified2/exceptions/file_not_readable'
require 'unified2/exceptions/binary_read_error'
+require 'unified2/exceptions/unknown_load_type'
+require 'unified2/exceptions/unknown_header_type'
@@ -0,0 +1,11 @@
+#
+# Unified2
+#
+module Unified2
+ #
+ # Unknown Header Type
+ #
+ class UnknownHeaderType < StandardError; end # class UnknownHeaderType
+
+end # module Unified2
+

0 comments on commit 5834d77

Please sign in to comment.