Skip to content

Commit

Permalink
Make Array#fetch exceptions compliant
Browse files Browse the repository at this point in the history
  • Loading branch information
meh committed Nov 8, 2013
1 parent b619097 commit 6639f14
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion opal/core/array.rb
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,12 @@ def fetch(index, defaults = undefined, &block)
return defaults;
}
#{ raise IndexError, "Array#fetch" };
if (self.length === 0) {
#{raise IndexError, "index #{`original`} outside of array bounds: 0...0"}
}
else {
#{raise IndexError, "index #{`original`} outside of array bounds: -#{`self.length`}...#{`self.length`}"};
}
}
end

Expand Down

0 comments on commit 6639f14

Please sign in to comment.