Refactor ArgumentError transformation into RangeError