MCPcopy Index your code
hub / github.com/developit/microbundle / logError

Function logError

src/log-error.js:4–29  ·  view source on GitHub ↗
(err)

Source from the content-addressed store, hash-verified

2import { stderr } from './utils';
3
4export default function logError(err) {
5 const error = err.error || err;
6 const description = `${error.name ? error.name + ': ' : ''}${
7 error.message || error
8 }`;
9 const message = error.plugin
10 ? `(${error.plugin} plugin) ${description}`
11 : description;
12
13 stderr(red().bold(message));
14
15 if (error.loc) {
16 stderr();
17 stderr(`at ${error.loc.file}:${error.loc.line}:${error.loc.column}`);
18 }
19
20 if (error.frame) {
21 stderr();
22 stderr(dim(error.frame));
23 } else if (err.stack) {
24 const headlessStack = error.stack.replace(message, '');
25 stderr(dim(headlessStack));
26 }
27
28 stderr();
29}

Callers 2

doWatchFunction · 0.85
runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…