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:
@@ -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() {
|
||||
|
||||
8
apps/desktop/src/autofill/models/autotype-errors.ts
Normal file
8
apps/desktop/src/autofill/models/autotype-errors.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* This error is surfaced when there is no matching
|
||||
* vault item found.
|
||||
*/
|
||||
export interface AutotypeMatchError {
|
||||
windowTitle: string;
|
||||
errorMessage: string;
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user