Esri/geotrigger-js — pull request #30 by ngoldman (2013-12-04 23:43:27+00:00)
Title: invalid auth fails silently

When creating a new session with invalid credentials, the session object should do more than emit `authentication:error`.

https://github.com/Esri/geotrigger-js/blob/master/geotrigger.js#L122

Network tab:

`{"error":{"code":400,"error":"invalid_request","error_description":"Invalid client_id","message":"invalid_request","details":[]}}`

Ideally an error handler callback should be able to be passed by the user, or upon initialization the user should be able to do something like

```js
var session = new Geotrigger.Session(config);

session
.success(function(){})
.error(function(){});

// OR

var session = new Geotrigger.Session(config, function(error, response) {});
```

Or something along those lines.. I think this method is a bit too indirect:

```js
session.on('authentication:error', function(){});
```

Not sure what the best approach is. @patrickarlt @JerrySievert thoughts?