Skip to content

Commit

Permalink
main: avoid printing errors twice (#396)
Browse files Browse the repository at this point in the history
When the main script throws an error it will be caught by the unhandled
promise handler, because the main script is ran asynchronously now,
after the introduction of TLA.
  • Loading branch information
saghul authored Sep 26, 2023
1 parent af0c8fb commit 4a07597
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 29 deletions.
51 changes: 24 additions & 27 deletions src/bundles/c/core/run-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include <inttypes.h>

const uint32_t tjs__run_main_size = 20603;
const uint32_t tjs__run_main_size = 20583;

const uint8_t tjs__run_main[20603] = {
const uint8_t tjs__run_main[20583] = {
0x02, 0xc0, 0x03, 0x16, 0x72, 0x75, 0x6e, 0x2d,
0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x6a, 0x73, 0x16,
0x74, 0x6a, 0x73, 0x3a, 0x67, 0x65, 0x74, 0x6f,
Expand Down Expand Up @@ -2556,30 +2556,27 @@ const uint8_t tjs__run_main[20603] = {
0x0e, 0x38, 0x1e, 0x01, 0x00, 0x00, 0x42, 0x36,
0x01, 0x00, 0x00, 0xb6, 0x24, 0x01, 0x00, 0x29,
0xbc, 0x03, 0x2f, 0x00, 0x0e, 0x02, 0x06, 0x01,
0x00, 0x00, 0x01, 0x00, 0x04, 0x02, 0x00, 0x40,
0x01, 0xac, 0x08, 0x03, 0x00, 0x03, 0xe2, 0x03,
0x0a, 0x00, 0xca, 0x03, 0x06, 0x09, 0x6c, 0x18,
0x00, 0x00, 0x00, 0xdd, 0x41, 0x31, 0x01, 0x00,
0x00, 0x42, 0x9a, 0x02, 0x00, 0x00, 0x65, 0x01,
0x00, 0x24, 0x01, 0x00, 0x0e, 0x0e, 0x29, 0xc9,
0x6c, 0x24, 0x00, 0x00, 0x00, 0x38, 0x2c, 0x01,
0x00, 0x00, 0x42, 0xb6, 0x01, 0x00, 0x00, 0xc5,
0x24, 0x01, 0x00, 0x0e, 0x38, 0x1e, 0x01, 0x00,
0x00, 0x42, 0x36, 0x01, 0x00, 0x00, 0xb6, 0x24,
0x01, 0x00, 0x0e, 0x0e, 0x29, 0x2f, 0xbc, 0x03,
0x2f, 0x00, 0x0e, 0x43, 0x06, 0x01, 0xee, 0x03,
0x02, 0x01, 0x02, 0x07, 0x00, 0x00, 0x48, 0x03,
0xc2, 0x03, 0x00, 0x01, 0x00, 0xc4, 0x03, 0x00,
0x01, 0x00, 0xc6, 0x03, 0x01, 0x00, 0x20, 0x61,
0x00, 0x00, 0x38, 0x95, 0x00, 0x00, 0x00, 0x42,
0x9b, 0x02, 0x00, 0x00, 0xd1, 0xbd, 0x0a, 0x24,
0x02, 0x00, 0xc9, 0x38, 0x95, 0x00, 0x00, 0x00,
0x42, 0x15, 0x02, 0x00, 0x00, 0x62, 0x00, 0x00,
0x24, 0x01, 0x00, 0xea, 0x1f, 0x38, 0x94, 0x00,
0x00, 0x00, 0x11, 0x04, 0x9c, 0x02, 0x00, 0x00,
0x42, 0x5c, 0x00, 0x00, 0x00, 0xd1, 0x04, 0x9d,
0x02, 0x00, 0x00, 0xd2, 0x24, 0x03, 0x00, 0x21,
0x01, 0x00, 0x2f, 0x62, 0x00, 0x00, 0x28, 0xbc,
0x03, 0x2f, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x00, 0x31,
0x00, 0xe2, 0x03, 0x0a, 0x00, 0xca, 0x03, 0x06,
0x09, 0x6c, 0x18, 0x00, 0x00, 0x00, 0xdd, 0x41,
0x31, 0x01, 0x00, 0x00, 0x42, 0x9a, 0x02, 0x00,
0x00, 0x65, 0x01, 0x00, 0x24, 0x01, 0x00, 0x0e,
0x0e, 0x29, 0x0e, 0x6c, 0x15, 0x00, 0x00, 0x00,
0x38, 0x1e, 0x01, 0x00, 0x00, 0x42, 0x36, 0x01,
0x00, 0x00, 0xb6, 0x24, 0x01, 0x00, 0x0e, 0x0e,
0x29, 0x2f, 0xbc, 0x03, 0x2f, 0x00, 0x0e, 0x43,
0x06, 0x01, 0xee, 0x03, 0x02, 0x01, 0x02, 0x07,
0x00, 0x00, 0x48, 0x03, 0xc2, 0x03, 0x00, 0x01,
0x00, 0xc4, 0x03, 0x00, 0x01, 0x00, 0xc6, 0x03,
0x01, 0x00, 0x20, 0x61, 0x00, 0x00, 0x38, 0x95,
0x00, 0x00, 0x00, 0x42, 0x9b, 0x02, 0x00, 0x00,
0xd1, 0xbd, 0x0a, 0x24, 0x02, 0x00, 0xc9, 0x38,
0x95, 0x00, 0x00, 0x00, 0x42, 0x15, 0x02, 0x00,
0x00, 0x62, 0x00, 0x00, 0x24, 0x01, 0x00, 0xea,
0x1f, 0x38, 0x94, 0x00, 0x00, 0x00, 0x11, 0x04,
0x9c, 0x02, 0x00, 0x00, 0x42, 0x5c, 0x00, 0x00,
0x00, 0xd1, 0x04, 0x9d, 0x02, 0x00, 0x00, 0xd2,
0x24, 0x03, 0x00, 0x21, 0x01, 0x00, 0x2f, 0x62,
0x00, 0x00, 0x28, 0xbc, 0x03, 0x2f, 0x00,
};

3 changes: 1 addition & 2 deletions src/js/run-main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ if (options.help) {
globalThis.queueMicrotask(() => {
try {
internals.core.evalFile(filename);
} catch (e) {
console.error(e);
} catch (_) {
tjs.exit(1);
}
});
Expand Down

0 comments on commit 4a07597

Please sign in to comment.