Package Exports
- stacktrace-metadata
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (stacktrace-metadata) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
stacktrace-metadata

Modify given
err
object to be more useful. Addsline
,column
andfilename
properties.
Install
npm i stacktrace-metadata --save
Usage
For more use-cases see the tests
example.js
'use strict'
var assert = require('assert')
var metadata = require('stacktrace-metadata')
function foobar (val) {
assert.equal(val, true)
return val
}
try {
foobar(1234)
} catch (err) {
var e = metadata(err)
console.log(e) // => AssertionError
console.log(e.line) // => 7
console.log(e.column) // => 10
console.log(e.actual) // => 1234
console.log(e.expected) // => true
console.log(e.message) // => '1234 == true'
}
Related libs
- abbrev-kindof: Use abbreviations for checking type of given value. Like
kindof(val, 'soa')
to check that value is string, object or array. | homepage - assert-kindof: Check native type of the given value and throw TypeError if not okey. Expressive, elegant, behavior-driven API, good descriptive default error messages, simple and clean syntax. | homepage
- assertit: Thin sugar layer on top of
testit
framework,is-kindof
andassert
. | homepage - is-kindof: Check type of given javascript value. Support promises, generators, streams, and native types. Thin wrapper around
kind-of
module. | homepage - is-typeof-error: Check that given value is any type of error and instanceof Error | homepage
- kind-error: Base class for easily creating meaningful and quiet by default Error classes with sane defaults and assertion in mind. | homepage
- kind-of-extra: Additional functionality to
kind-of
type check utility, support promises, generators, streams, errors. Like thatkindOf(new Error('foo')) === 'error'
. | homepage - kind-of-types: List of all javascript types. Used and useful for checking, validation, sanitizing and testing. Like isStream, isPromise, isWeakset and etc. | homepage
- map-types: Map single letter abbreviations to javascript native types. Useful as a shorthand for pseudo-argument destructuring when debugging. | homepage
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.