Skip to content

Commit

Permalink
feat(loader): on drive error, send halt to CU
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrain99 committed Dec 16, 2024
1 parent c9659f1 commit 5c378d0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion dev-cli/container/src/aolibc/aostdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ EM_ASYNC_JS(int, weavedrive_open, (const char* c_filename, const char* mode), {
}

const drive = Module.WeaveDrive(Module, FS);
return await drive.open(filename);
const driveResponse = await drive.open(filename);
if (typeof driveResponse === 'string') {
throw new Error('HALT: FILE NOT FOUND')
}
return driveResponse;
});

EM_ASYNC_JS(int, weavedrive_read, (int fd, int *dst_ptr, size_t length), {
Expand Down
6 changes: 5 additions & 1 deletion loader/src/formats/wasm64-emscripten.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,11 @@ function __asyncjs__weavedrive_open(c_filename, mode) {
return Promise.resolve(null);
}
const drive = Module.WeaveDrive(Module, FS);
return await drive.open(filename);
const driveResponse = await drive.open(filename);
if (typeof driveResponse === 'string') {
throw new Error('HALT: FILE NOT FOUND')
}
return driveResponse
});
}

Expand Down

0 comments on commit 5c378d0

Please sign in to comment.