0.2.4 • Published 2 years ago

@stack-tools/node-tools v0.2.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@stack-tools/node-tools

node-tools provides utilites for printing and parsing node errors and their stacks.

node-tools is a shim on top of v8-tools which expands the definition of isInternalFrame to include node internal modules like fs.

Usage

import getPackageName from 'get-package-name';
import {
  isInternalFrame as isNodeInternalFrame,
  parseErrors,
  cleanErrors,
  printErrors,
} from '@stack-tools/node-tools';

const internalPackages = new Set([
  'my-package',
  'test-runner',
]);

const isInternalFrame = (frame) => {
  return (
    isNodeInternalFrame(frame) ||
    (frame.site.type === 'path' &&
      internalPackages.has(getPackageName(frame.site.file)))
  );
};

try {
  doStuff();
} catch (e) {
  const errors = parseErrors(e);

  cleanErrors(errors, isInternalFrame);

  console.error(printErrors(errors));
}
0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago