added basic error callback & Cordova 3.x support