Fix RESTAdapter error handling

Fixes issue #486 RESTAdapter: cannot call method didError of undefined