woodwork-interceptor-error

Used with woodwork-logger, handles Error's and exposes non-enumerable properties for you.

Usage no npm install needed!

<script type="module">
  import woodworkInterceptorError from 'https://cdn.skypack.dev/woodwork-interceptor-error';
</script>

README

woodwork-interceptor-error

Table of Contents

Install

npm install woodwork-interceptor-error

Example

const woodwork = require('woodwork-logger');
const woodworkInterceptorError = require('woodwork-interceptor-error');

const logger = woodwork.create('service-a', {
  interceptors: [
    woodworkInterceptorError(/* options */),
  ],
  request: (events) => { /* ... code */ },
});

API

woodworkInterceptorError(options: Object): Function

options.getOwnproperties: Boolean (default: true)

This is helpful to include any custom created properties on a custom Error object in the event.

options.whitelist: Array (default: ['message', 'name', 'stack'])

Which properties should be included from the original Error object, which are non-enumerable and wouldn't otherwise be included.