Permalink
Browse files

echo data on value error

  • Loading branch information...
1 parent c2e61b1 commit c9b33d69825a60252224a409d4044ca79dee5f8f @funny-falcon funny-falcon committed May 13, 2014
Showing with 8 additions and 1 deletion.
  1. +8 −1 lib/tarantool/response.rb
@@ -73,6 +73,7 @@ def parse_response(data)
end
end
+ X02 = '%02x'.freeze
def unpack_tuples(data)
tuples_affected = ::BinUtils.slice_int32_le!(data)
fields = fields()
@@ -81,7 +82,13 @@ def unpack_tuples(data)
else
tail = 1
end
- _unpack_tuples(data, fields, tail, tuples_affected)
+ orig_data = data.dup
+ begin
+ _unpack_tuples(data, fields, tail, tuples_affected)
+ rescue ValueError => e
+ $stderr.puts "Value Error: tuples=#{tuples_affected}, data='#{orig_data.each_byte.map{|b| format(X02, b)}.join(' ')}'"
+ raise e
+ end
end
def _unpack_tuples(data, fields, tail, tuples_affected)

0 comments on commit c9b33d6

Please sign in to comment.