1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-08 03:23:50 +00:00

Desktop Autotype fix IPC error handling (#17332)

* Desktop Autotype fix IPC error handling

* TS lint

* sweep sweep: fix unecessary member name qualifier
This commit is contained in:
neuronull
2025-11-21 14:02:22 -07:00
committed by GitHub
parent 23ac477bbc
commit 489eb40057
3 changed files with 23 additions and 4 deletions

View File

@@ -5,6 +5,7 @@ import { LogService } from "@bitwarden/logging";
import { WindowMain } from "../../main/window.main";
import { stringIsNotUndefinedNullAndEmpty } from "../../utils";
import { AutotypeMatchError } from "../models/autotype-errors";
import { AutotypeVaultData } from "../models/autotype-vault-data";
import { AutotypeKeyboardShortcut } from "../models/main-autotype-keyboard-shortcut";
@@ -56,6 +57,14 @@ export class MainDesktopAutotypeService {
this.doAutotype(vaultData, this.autotypeKeyboardShortcut.getArrayFormat());
}
});
ipcMain.on("autofill.completeAutotypeError", (_event, matchError: AutotypeMatchError) => {
this.logService.debug(
"autofill.completeAutotypeError",
"No match for window: " + matchError.windowTitle,
);
this.logService.error("autofill.completeAutotypeError", matchError.errorMessage);
});
}
disableAutotype() {

View File

@@ -0,0 +1,8 @@
/**
* This error is surfaced when there is no matching
* vault item found.
*/
export interface AutotypeMatchError {
windowTitle: string;
errorMessage: string;
}

View File

@@ -5,6 +5,7 @@ import type { autofill } from "@bitwarden/desktop-napi";
import { Command } from "../platform/main/autofill/command";
import { RunCommandParams, RunCommandResult } from "../platform/main/autofill/native-autofill.main";
import { AutotypeMatchError } from "./models/autotype-errors";
import { AutotypeVaultData } from "./models/autotype-vault-data";
export default {
@@ -141,7 +142,7 @@ export default {
ipcRenderer.on(
"autofill.listenAutotypeRequest",
(
event,
_event,
data: {
windowTitle: string;
},
@@ -150,10 +151,11 @@ export default {
fn(windowTitle, (error, vaultData) => {
if (error) {
ipcRenderer.send("autofill.completeError", {
const matchError: AutotypeMatchError = {
windowTitle,
error: error.message,
});
errorMessage: error.message,
};
ipcRenderer.send("autofill.completeAutotypeError", matchError);
return;
}
if (vaultData !== null) {