Handle errors properly

This commit is contained in:
varjolintu 2023-07-16 14:36:45 +03:00
parent bfd6988240
commit 5859f15c44

View file

@ -83,7 +83,7 @@ keepassClient.sendNativeMessage = function(request, enableTimeout = false, timeo
const handler = (msg) => {
if (msg && msg?.action === action) {
// If the request has a separate requestID, check if it matches when there's no nonce (an error message)
const isNotificationOrError = !msg.nonce && request.requestID === msg.requestID;
const isNotificationOrError = !msg.nonce && (request.requestID === msg.requestID || (msg.error && msg.errorCode));
// Only resolve a matching response or a notification (without nonce)
if (isNotificationOrError || messageBuffer.matchAndRemove(msg)) {