in packages/sqrl-cli/src/repl/SqrlRepl.ts [118:154]
private async eval(cmd, context, filename) {
this.busy.increment();
const ctx = this.traceFactory();
try {
appendFileSync(this.historyPath, cmd);
if (cmd.trim() === "help") {
this.printHelp();
return;
}
const result = await this.repl(ctx, cmd);
if (result instanceof SqrlObject) {
console.log(spanToShell(result.render()).trimRight());
return result.getBasicValue();
}
return result;
} catch (e) {
if (this.isRecoverableError(e)) {
throw new repl.Recoverable(e);
} else if (e instanceof SqrlCompileError) {
console.log(chalk.red(e.message));
return;
} else if (e instanceof SlotMissingCallbackError) {
console.log(
chalk.red("Required feature was not defined: ") +
chalk.red.bold(e.slotName)
);
} else {
throw e;
}
} finally {
this.busy.decrement();
}
}