mirror of
https://github.com/bitwarden/browser
synced 2025-12-21 10:43:35 +00:00
Ps/improve-log-service (#8989)
* Match console method signatures in logService abstraction * Add a few usages of improved signature * Remove reality check test * Improve electron logging
This commit is contained in:
@@ -76,7 +76,8 @@ export default class RuntimeBackground {
|
||||
|
||||
void this.processMessageWithSender(msg, sender).catch((err) =>
|
||||
this.logService.error(
|
||||
`Error while processing message in RuntimeBackground '${msg?.command}'. Error: ${err?.message ?? "Unknown Error"}`,
|
||||
`Error while processing message in RuntimeBackground '${msg?.command}'.`,
|
||||
err,
|
||||
),
|
||||
);
|
||||
return false;
|
||||
|
||||
@@ -28,6 +28,7 @@ describe("OffscreenDocument", () => {
|
||||
});
|
||||
|
||||
it("shows a console message if the handler throws an error", async () => {
|
||||
const error = new Error("test error");
|
||||
browserClipboardServiceCopySpy.mockRejectedValueOnce(new Error("test error"));
|
||||
|
||||
sendExtensionRuntimeMessage({ command: "offscreenCopyToClipboard", text: "test" });
|
||||
@@ -35,7 +36,8 @@ describe("OffscreenDocument", () => {
|
||||
|
||||
expect(browserClipboardServiceCopySpy).toHaveBeenCalled();
|
||||
expect(consoleErrorSpy).toHaveBeenCalledWith(
|
||||
"Error resolving extension message response: Error: test error",
|
||||
"Error resolving extension message response",
|
||||
error,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ class OffscreenDocument implements OffscreenDocumentInterface {
|
||||
Promise.resolve(messageResponse)
|
||||
.then((response) => sendResponse(response))
|
||||
.catch((error) =>
|
||||
this.consoleLogService.error(`Error resolving extension message response: ${error}`),
|
||||
this.consoleLogService.error("Error resolving extension message response", error),
|
||||
);
|
||||
return true;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user