From dc8cc7f42d1d7f6d87252da13b15b177317f362f Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Fri, 8 Dec 2023 22:34:11 -0400 Subject: write: live-dev-server: output full error traces --- src/write/build-modes/live-dev-server.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/write/build-modes') diff --git a/src/write/build-modes/live-dev-server.js b/src/write/build-modes/live-dev-server.js index b0272809..e2c976b9 100644 --- a/src/write/build-modes/live-dev-server.js +++ b/src/write/build-modes/live-dev-server.js @@ -2,8 +2,9 @@ import {spawn} from 'node:child_process'; import * as http from 'node:http'; import {readFile, stat} from 'node:fs/promises'; import * as path from 'node:path'; +import {inspect as nodeInspect} from 'node:util'; -import {logInfo, logWarn, progressCallAll} from '#cli'; +import {ENABLE_COLOR, logInfo, logWarn, progressCallAll} from '#cli'; import {watchContentDependencies} from '#content-dependencies'; import {quickEvaluate} from '#content-function'; import * as html from '#html'; @@ -24,6 +25,10 @@ const defaultPort = 8002; export const description = `Hosts a local HTTP server which generates page content as it is requested, instead of all at once; reacts to changes in data files, so new reloads will be up-to-date with on-disk YAML data (<- not implemented yet, check back soon!)\n\nIntended for local development ONLY; this custom HTTP server is NOT rigorously tested and almost certainly has security flaws`; +function inspect(value, opts = {}) { + return nodeInspect(value, {colors: ENABLE_COLOR, ...opts}); +} + export function getCLIOptions() { return { host: { @@ -82,7 +87,7 @@ export async function go({ if (error instanceof AggregateError && niceShowAggregate) { niceShowAggregate(error); } else { - console.error(error); + console.error(inspect(error, {depth: Infinity})); } }; -- cgit 1.3.0-6-gf8a5