aboutsummaryrefslogtreecommitdiff
path: root/src/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.ts')
-rw-r--r--src/index.ts17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/index.ts b/src/index.ts
index f6d46d6..4775823 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -15,12 +15,17 @@ const main = () => {
.description('Run a typescript .ts file')
.argument('<file>', 'Typescript file to run')
.action(async (filePath) => {
- const ctx = createContext({ filePath })
- const resultType = ctx.entryPoint.getType()
- const effects = resultType.isTuple()
- ? resultType.getTupleElements()
- : [resultType]
- await evalList(ctx, effects)
+ try {
+ const ctx = createContext({ filePath })
+ const resultType = ctx.entryPoint.getType()
+ const effects = resultType.isTuple()
+ ? resultType.getTupleElements()
+ : [resultType]
+ await evalList(ctx, effects)
+ } catch (e) {
+ console.error(e)
+ process.exit(1)
+ }
})
return program.parseAsync()