1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00

Fix REPL formatting (#1744)

This commit is contained in:
Kevin (Kun) "Kassimo" Qian 2019-02-11 15:06:22 -08:00 committed by Ryan Dahl
parent a4dec944bc
commit 1e5e091cb0

View file

@ -103,8 +103,7 @@ export async function replLoop(): Promise<void> {
if (err.message !== "Interrupted") { if (err.message !== "Interrupted") {
// e.g. this happens when we have deno.close(3). // e.g. this happens when we have deno.close(3).
// We want to display the problem. // We want to display the problem.
const formattedError = formatError( const formattedError = formatError(libdeno.errorToJSON(err));
libdeno.errorToJSON(err));
console.error(formattedError); console.error(formattedError);
} }
// Quit REPL anyways. // Quit REPL anyways.
@ -126,8 +125,7 @@ export async function replLoop(): Promise<void> {
} else { } else {
// e.g. this happens when we have deno.close(3). // e.g. this happens when we have deno.close(3).
// We want to display the problem. // We want to display the problem.
const formattedError = formatError( const formattedError = formatError(libdeno.errorToJSON(err));
libdeno.errorToJSON(err));
console.error(formattedError); console.error(formattedError);
quitRepl(1); quitRepl(1);
} }
@ -143,8 +141,7 @@ function evaluate(code: string): boolean {
const [result, errInfo] = libdeno.evalContext(code); const [result, errInfo] = libdeno.evalContext(code);
if (!errInfo) { if (!errInfo) {
console.log(result); console.log(result);
} else if (errInfo.isCompileError && } else if (errInfo.isCompileError && isRecoverableError(errInfo.thrown)) {
isRecoverableError(errInfo.thrown)) {
// Recoverable compiler error // Recoverable compiler error
return false; // don't consume code. return false; // don't consume code.
} else { } else {