jdeferred/jdeferred — pull request #40 by giordy (2014-11-23 17:00:23+00:00)
Title: OneReject should extend Throwable

Hello,

first of all thanks for your work, this library is very helpful and made my code much more readable.
I think I might have found a small glitch.
I wrote some code with this structure:

````java
DeferredManager dm = new DefaultDeferredManager();
Promise p1, p2;
// Initialize promises p1, p2
dm.when(p1, p2)
.then(new DonePipe() {
@Override
public Promise pipeDone(MultipleResults results) {
Promise p3 = createAndGetPromise4();
return p3;
}
})
.then(new DonePipe() {
@Override
public Promise pipeDone(String result) {
Promise p4 = createAndGetPromise4();
return p4;
}
})
.done(new DoneCallback() {
@Override
public void onDone(Integer result) {
//do something
}
})
.fail(new FailCallback() {
@Override
public void onFail(Throwable e) {
// p2 fails and I get org.jdeferred.multiple.OneReject which cannot be cast to Throwable
}
})
````

When p2 fails I get this exception
````
java.lang.ClassCastException: org.jdeferred.multiple.OneReject cannot be cast to java.lang.Throwable
````

Perhaps class OneReject should extend Throwable?

Thanks for your amazing work :)