Skip to content

Commit

Permalink
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
@@ -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

0 comments on commit 6639f14

Please sign in to comment.