shamblett / sporran

A PouchDB like browser application in Dart

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update exception reporting for future based methods

shamblett opened this issue · comments

Methods that return a future and raise exceptions should raise the exception so as the callers future handler can catch it.

Sporran should be updated as follows -

Future put(....){
if (id == null) {
return new Future.error(new SporranException('put() expects a doc id.'));
}

this allows -

localSporran.put(....).then((jsonobject.JsonObject res) {
//do something
}, onError:(SporranException e){
//do something
});

Note, this update has been applied to the Wilt package, Sporran also needs general method parameter checking added to its methods.

Changes incorporated, can be closed