diff --git a/js/logging.js b/js/logging.js index e675e44ef..0c7cb1186 100644 --- a/js/logging.js +++ b/js/logging.js @@ -137,6 +137,6 @@ window.onerror = (message, script, line, col, error) => { window.addEventListener('unhandledrejection', rejectionEvent => { const error = rejectionEvent.reason; - const errorInfo = error && error.stack ? error.stack : JSON.stringify(error); - window.log.error(`Top-level unhandled promise rejection: ${errorInfo}`); + const errorInfo = error && error.stack ? error.stack : error; + window.log.error('Top-level unhandled promise rejection:', errorInfo); }); diff --git a/js/models/conversations.js b/js/models/conversations.js index 6ecf74d29..ab9db964d 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -2210,16 +2210,20 @@ return; } - const profileKeyBuffer = window.Signal.Crypto.base64ToArrayBuffer( - profileKey - ); - const accessKeyBuffer = await window.Signal.Crypto.deriveAccessKey( - profileKeyBuffer - ); - const accessKey = window.Signal.Crypto.arrayBufferToBase64( - accessKeyBuffer - ); - this.set({ accessKey }); + try { + const profileKeyBuffer = window.Signal.Crypto.base64ToArrayBuffer( + profileKey + ); + const accessKeyBuffer = await window.Signal.Crypto.deriveAccessKey( + profileKeyBuffer + ); + const accessKey = window.Signal.Crypto.arrayBufferToBase64( + accessKeyBuffer + ); + this.set({ accessKey }); + } catch (e) { + window.log.warn(`Failed to derive access key for ${this.id}`); + } }, async upgradeMessages(messages) {