module BSON::Hash
def serialize_key(buffer, key)
-
(EncodingError)- if the string is not a valid encoding -
(ArgumentError)- if the string cannot be serialized
Parameters:
-
buffer(ByteBuf) -- The buffer to received the serialized
def serialize_key(buffer, key) buffer.put_cstring(key) rescue ArgumentError => e raise ArgumentError, "Error serializing key #{key}: #{e.class}: #{e}" rescue EncodingError => e # Note this may convert exception class from a subclass of # EncodingError to EncodingError itself raise EncodingError, "Error serializing key #{key}: #{e.class}: #{e}" end