Skip to content

Commit

Permalink
print more detailed error of shell script execution, #387 [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimiry committed Feb 2, 2023
1 parent 6c0e869 commit 1da058c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "electron-mail",
"description": "Unofficial ProtonMail Desktop App",
"version": "5.1.3",
"version": "5.1.4",
"author": "Vladimir Yakovlev <[email protected]>",
"license": "GPL-3.0",
"homepage": "https://github.com/vladimiry/ElectronMail",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import electronLog from "electron-log";
import {exec} from "child_process";
import {pick} from "remeda";
import {promisify} from "util";
import {shouldInterruptAfterDeadline} from "quickjs-emscripten";

Expand Down Expand Up @@ -106,9 +107,13 @@ export const executeUnreadNotificationShellCommand = async (

try {
await promisify(exec)(command, execOptions);
} catch {
// we don't show/log a possibly sensitive data (like command to execute or its options)
// so the original error gets suppressed
throw new Error("Failed to execute a triggered by an unread desktop notification shell exec command!");
} catch (error) {
// we don't show/log a possibly sensitive data (like command to execute or its options), so the original error gets suppressed
throw new Error(
"Failed to execute a triggered by an unread desktop notification shell exec command: " +
JSON.stringify(
pick(Object(error) as unknown as { errno: unknown, code: unknown }, ["errno", "code"]),
),
);
}
};

0 comments on commit 1da058c

Please sign in to comment.