Wrap set credentials for the keychain in a try/catch (#1962)

* Wrap set credentials for the keychain in a try/catch

* Only wrap the setGenericPassword method
This commit is contained in:
Elias Nahum 2018-08-02 15:44:30 -04:00 committed by GitHub
parent 5bed4d7400
commit 102faceb2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -161,6 +161,7 @@ export default class App {
if (!currentUserId) {
return;
}
const username = `${deviceToken}, ${currentUserId}`;
const password = `${token},${url}`;
@ -172,7 +173,11 @@ export default class App {
// Only save to keychain if the url and token are set
if (url && token) {
setGenericPassword(username, password);
try {
setGenericPassword(username, password);
} catch (e) {
console.warn('could not set credentials', e); //eslint-disable-line no-console
}
}
};