lib/bindata/sanitize.rb in bindata-0.11.1 vs lib/bindata/sanitize.rb in bindata-1.0.0
- old
+ new
@@ -1,9 +1,11 @@
require 'bindata/registry'
module BinData
+ class UnknownTypeError < StandardError ; end
+
# A BinData object accepts arbitrary parameters. This class sanitizes
# those parameters so they can be used by the BinData object.
class SanitizedParameters
def initialize(params, the_class)
@@ -167,10 +169,10 @@
end
def lookup_class(type)
registered_class = RegisteredClasses.lookup(type, @endian)
if registered_class.nil?
- raise TypeError, "unknown type '#{type}'"
+ raise UnknownTypeError, type.to_s
end
registered_class
end
#---------------