hull/hull-js — pull request #129 by oliger (2014-01-28 18:24:53+00:00)
Title: Handle login error

```js
Hull.login('facebook').then(function(user) {
console.log('Hello ' + user.name);
}, function(error) {
if (error.reason === 'email_taken') {
console.log(error.email + ' is already taken by user with id: ' + error.user_id)
} else if (error.reason === 'user_cancelled') {
console.log('User cancelled login');
} else {
console.log('Something when wrong on Hull side...');
}
});
```

```js
Hull.linkIdentity('twitter').then(function() {
console.log('Twitter identity has been linked');
}, function(error) {
if (error.reason == 'identity_taken') {
console.log('Twitter identity is already linked to another user');
} else {
console.log('Something when wrong on Hull side...');
}
});
```

```js
Hull.unlinkIdentity('twitter').then(function() {
alert('Twitter identity has been unlinked');
}, function(error) {
console.log(error.message);
});
```

```js
Hull.logout().then(function() {
console.log('Goodbye');
});
```