Ruby rescue TypeError is not catching TypeError exception -


i'm using gem called bindata has following code block:

def assign(val)   raise argumenterror, "can't set nil value #{debug_name}" if val.nil?    unless has_parameter?(:value)     raw_val = val.respond_to?(:snapshot) ? val.snapshot : val     @value = begin                raw_val.dup              rescue typeerror                # can't dup fixnums                raw_val              end   end end 

this code meant dup object sent assign function, fixnum cannot dup'd creators put rescue block in there. have tested code multiple times in rails console , rescue works fine. however:

i, [2017-04-08t00:03:47.165387 #27899]  info -- : *** below find recent exception thrown, (but not certainly) exception made application exit abnormally *** e, [2017-04-08t00:03:47.165450 #27899] error -- : can't dup fixnum (typeerror) /home/blueserver/.rvm/gems/ruby-1.9.3-p327-turbo@symphony/gems/bindata-1.4.3/lib/bindata/base_primitive.rb:90:in `dup' /home/blueserver/.rvm/gems/ruby-1.9.3-p327-turbo@symphony/gems/bindata-1.4.3/lib/bindata/base_primitive.rb:90:in `assign' (eval):3:in `assign' 

it seems code working in catching error %99.99 of time, every once in while crashes instead. idea why rescue randomly fail? code splattered calls bindata gem, putting rescue surrounding every call tedious effort.

thanks!


Comments

Popular posts from this blog

cookies - Yii2 Advanced - Share session between frontend and mainsite (duplicate of frontend for www) -

angular - password and confirm password field validation angular2 reactive forms -

php - Permission denied. Laravel linux server -