Skip to content

Commit

Permalink
fix: should show load script error
Browse files Browse the repository at this point in the history
  • Loading branch information
snowyu committed Jun 17, 2024
1 parent 74239c2 commit a001453
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lib/run-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ export async function runScript(filename: string, options: IRunScriptOptions) {

AIScriptEx.searchPaths = Array.isArray(options.agentDirs) ? options.agentDirs : ['.']

const script = AIScriptEx.load(filename, {chatsDir: options.chatsDir})
let script
try {
script = AIScriptEx.load(filename, {chatsDir: options.chatsDir})
} catch(err) {
console.error('Load script error:',err)
process.exit(1)
}
const chatsFilename = script.getChatsFilename()
if (options.newChat && chatsFilename) { renameOldFile(chatsFilename) }

Expand Down

0 comments on commit a001453

Please sign in to comment.