Skip to content

Commit 522f973

Browse files
committed
handle NOENT error
If the user hits run from a program window of a program that has not been saved to the XRP (maybe from a different XRP) then an error dialog will let them know.
1 parent 278ed06 commit 522f973

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/connections/connection.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import ConnectionMgr from "@/managers/connectionmgr";
2+
import AppMgr, { EventType } from "@/managers/appmgr";
23
import logger from "@/utils/logger";
4+
import i18n from "@/utils/i18n";
35
import Joystick from '@/managers/joystickmgr';
46
import TableMgr from '@/managers/tablemgr';
57

@@ -546,6 +548,12 @@ abstract class Connection {
546548
if (result[i].includes("[Errno", 0)) {
547549
this.runError = result[i];
548550
console.log("run time error: " + this.runError);
551+
if (this.runError.includes('[Errno 2] ENOENT')) {
552+
AppMgr.getInstance().emit(
553+
EventType.EVENT_ALERT,
554+
i18n.t('program-not-saved-to-xrp'),
555+
);
556+
}
549557
}
550558
}
551559
}
@@ -654,7 +662,7 @@ abstract class Connection {
654662
this.startReaduntil(">>>");
655663
await this.writeToDevice("\r" + this.CTRL_CMD_KINTERRUPT);
656664
result = await this.haltUntilRead(2, 5); //this should be fast
657-
if (result != undefined) {
665+
if (result != undefined && result.length > 0) {
658666
gotToPrompt = true;
659667
break;
660668
}

src/utils/i18n/locales/en/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@
158158
"update-lib-complete": "The XRP library update process has completed successfully.",
159159
"dashboard": "Dashboard",
160160
"no-editor-run": "Please select a tab with code before pressing Run.",
161+
"program-not-saved-to-xrp": "This program has not been saved to the XRP. Please save it to the XRP before running.",
161162
"FilesystemStorage": "XRP Filesystem: {{ capacity }} MB",
162163
"GoogleDriveStorage": "Google Drive Filesystem",
163164
"sensors": "Sensors",

src/utils/i18n/locales/es/es.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@
156156
"update-lib-complete": "El proceso de actualización de la biblioteca XRP se ha completado con éxito.",
157157
"dashboard": "Panel",
158158
"no-editor-run": "Seleccione una pestaña con código antes de presionar Ejecutar.",
159+
"program-not-saved-to-xrp": "Este programa no se ha guardado en el XRP. Guárdelo en el XRP antes de ejecutarlo.",
159160
"FilesystemStorage": "Sistema de archivos XRP: {{ capacity }} MB",
160161
"GoogleDriveStorage": "Sistema de archivos de Google Drive",
161162
"sensors": "Sensores",

0 commit comments

Comments
 (0)