Skip to content

Commit 1ef0012

Browse files
authored
Merge pull request #165 from Accedia/feat/show-error-and-instructions-how-to-fix-it-if-file-is-not-found
Feat/show error and instructions how to fix it if file is not found
2 parents ed94d93 + c721c3c commit 1ef0012

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

electron-app/src/main.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ResponseData } from './interfaces/ResponseData';
2-
import { app, globalShortcut, ipcMain, shell,dialog } from 'electron';
2+
import { app, globalShortcut, ipcMain, shell, dialog } from 'electron';
33
import WindowManager from './utils/window_manager';
44
import importer from './utils/importer';
55
import { MESSAGE } from './constants/messages';
@@ -69,9 +69,12 @@ class Main {
6969
log.info(fitMitchellCloudPath);
7070
const bat = spawn(fitMitchellCloudPath, [], { windowsHide: true });
7171
log.info('here');
72-
72+
bat.on('error', (code) => {
73+
dialog.showErrorBox('Error', `The specified file was not found: ${fitMitchellCloudPath}. Please make sure that file FIT.bat is in the specified directory`);
74+
app.quit();
75+
})
7376
bat.on('close', (code) => {
74-
log.info(`Child process exited with code ${code}`);
77+
log.info(`Child process exited with code ${code}`);
7578
app.quit();
7679
});
7780
return;

electron-app/src/utils/window_manager.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@ class WindowManager {
8282
if (shouldOpenVBS) {
8383
try {
8484
const bat = spawn(fitMitchellCloudPath, [], { windowsHide: true });
85+
bat.on('error', (code) => {
86+
dialog.showErrorBox('Error', `The specified file was not found: ${fitMitchellCloudPath}. Please make sure that file FIT.bat is in the specified directory`);
87+
app.quit();
88+
})
8589
bat.on('close', (code) => {
8690
console.log(`Child process exited with code ${code}`);
8791
app.quit();
8892
});
89-
bat.on('error', (code) => {
90-
dialog.showErrorBox('Error', `The specified file was not found: ${fitMitchellCloudPath}, Error code : ${code}`);
91-
app.quit();
92-
})
9393
return;
9494
} catch (error) {
9595
dialog.showErrorBox('Error', 'The specified file was not found: C:\\FIT-Mitchell-Cloud-RO-Import-Tool\\FIT.bat');

0 commit comments

Comments
 (0)