emberjs/ember.js — pull request #3531 by jamesotron (2013-10-05 08:05:44+00:00)
Title: Fix explosion in `Ember.SubArray`'s `_findOperation` when no operations are present in the SubArray.

While working on #3518 I came across a problem where if you call `removeAt` on a sub array with no operations, then it explodes:

```javascript
subArray = new Em.SubArray();
subArray.removeItem(2);
# TypeError: undefined is not a function
```

This is because SubArray's `removeItem` function calls `_findOperation` without providing the second, unhappy-path callback. Now, I'm not sure if this should blow up (in a more sensible way) or simply return `-1`. Perhaps @hjdivad can shed some light?

In the mean time I have patched `_findOperation` not to call `notFoundCallback` when it is undefined and written a test to verify that -1 is returned. Would this be a good use for promises?