diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-12-08 22:34:11 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-12-28 17:14:15 -0400 |
commit | dc8cc7f42d1d7f6d87252da13b15b177317f362f (patch) | |
tree | d9e064495f3852c52a75347365a6608011b85fa0 | |
parent | 7b77a1d8cafeb25d6f9c7e8a0c93f4aae0cc049b (diff) |
write: live-dev-server: output full error traces
-rw-r--r-- | src/write/build-modes/live-dev-server.js | 9 |
1 files changed, 7 insertions, 2 deletions
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})); } }; |