Skip to content

Commit f3d8acf

Browse files
committed
feat: forward exception on login errors
1 parent b34bc1a commit f3d8acf

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

__tests__/auth.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ describe('Auth', () => {
106106
return a.login()
107107
.then(() => a.logout())
108108
.then(() => {
109-
expect(fnError).toBeCalled();
109+
expect(fnError).toBeCalledWith('Login failed', 'Simulated failure');
110110
expect(fnStop).toBeCalled();
111111
});
112112
});

src/adapters/ui/login.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ const create = (options, login, startHidden, $container) => {
173173

174174
ee.on('login:start', () => a.setLoading(true));
175175
ee.on('login:stop', () => a.setLoading(false));
176-
ee.on('login:error', err => a.setError(err));
176+
ee.on('login:error', (msg) => a.setError(msg));
177177

178178
return ee;
179179
};

src/auth.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ export default class Auth {
246246
logger.warn('Exception on login', e);
247247
}
248248

249-
this.ui.emit('login:error', 'Login failed');
249+
this.ui.emit('login:error', 'Login failed', e);
250250
this.ui.emit('login:stop');
251251

252252
return false;

src/login.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export default class Login extends EventEmitter {
142142
ui.on('login:post', values => this.emit('login:post', values));
143143
this.on('login:start', () => ui.emit('login:start'));
144144
this.on('login:stop', () => ui.emit('login:stop'));
145-
this.on('login:error', err => ui.emit('login:error', err));
145+
this.on('login:error', (msg, err) => ui.emit('login:error', msg, err));
146146
}
147147

148148
}

0 commit comments

Comments
 (0)