diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f3f64fc..b5463654 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ - Fix field error message color - [#433](https://github.com/estruyf/vscode-front-matter/issues/433): Fix issue with rendering an incorrect title value on the content dashboard +- [#462](https://github.com/estruyf/vscode-front-matter/issues/462): Fix issue in script error notification ## [8.1.2] - 2022-10-06 diff --git a/src/helpers/CustomScript.ts b/src/helpers/CustomScript.ts index 95525db5..e80c893c 100644 --- a/src/helpers/CustomScript.ts +++ b/src/helpers/CustomScript.ts @@ -195,7 +195,11 @@ export class CustomScript { const output = await CustomScript.executeScript(script, wsPath, `"${wsPath}" "${contentPath}" ${articleData}`); return output; } catch (e) { - Notifications.error(`${script.title}: ${(e as Error).message}`); + if (typeof e === "string") { + Notifications.error(`${script.title}: ${e}`); + } else { + Notifications.error(`${script.title}: ${(e as Error).message}`); + } return null; } } @@ -285,6 +289,7 @@ export class CustomScript { exec(fullScript, (error, stdout) => { if (error) { reject(error.message); + return; } if (stdout && stdout.endsWith(`\n`)) {