web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
2.8 KiB

  1. error-stack-parser.js - Extract meaning from JS Errors
  2. ===============
  3. [![Build Status](https://img.shields.io/travis/stacktracejs/error-stack-parser/master.svg?style=flat-square)](https://travis-ci.org/stacktracejs/error-stack-parser)
  4. [![Coverage Status](https://img.shields.io/coveralls/stacktracejs/error-stack-parser.svg?style=flat-square)](https://coveralls.io/r/stacktracejs/error-stack-parser?branch=master)
  5. [![GitHub license](https://img.shields.io/github/license/stacktracejs/error-stack-parser.svg?style=flat-square)](https://opensource.org/licenses/MIT)
  6. [![size with dependencies](https://img.shields.io/badge/size-4.8k-green.svg?style=flat-square)](https://github.com/stacktracejs/error-stack-parser/releases)
  7. [![gzip size](https://img.shields.io/badge/gzipped-1.8k-green.svg?style=flat-square)](https://github.com/stacktracejs/error-stack-parser/releases)
  8. [![module format](https://img.shields.io/badge/module%20format-umd-lightgrey.svg?style=flat-square&colorB=ff69b4)](https://github.com/stacktracejs/error-stack-parser/releases)
  9. [![code of conduct](https://img.shields.io/badge/code%20of-conduct-lightgrey.svg?style=flat-square&colorB=ff69b4)](http://todogroup.org/opencodeofconduct/#stacktrace.js/me@eriwen.com)
  10. [![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/error-stack-parser/badge)](https://www.jsdelivr.com/package/npm/error-stack-parser)
  11. Simple, cross-browser [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) parser.
  12. This library parses and extracts function names, URLs, line numbers, and column numbers from the given Error's `stack` as
  13. an Array of [StackFrame](http://git.io/stackframe)s.
  14. Once you have parsed out StackFrames, you can do much more interesting things. See [stacktrace-gps](http://git.io/stacktrace-gps).
  15. Note that in IE9 and earlier, `Error` objects don't have enough information to extract much of anything. In IE 10, `Error`s
  16. are given a `stack` once they're `throw`n.
  17. ## Browser Support
  18. [![Sauce Test Status](https://saucelabs.com/browser-matrix/stacktracejs.svg)](https://saucelabs.com/u/stacktracejs)
  19. ## Usage
  20. ```js
  21. ErrorStackParser.parse(new Error('BOOM'));
  22. => [
  23. StackFrame({functionName: 'foo', args: [], fileName: 'path/to/file.js', lineNumber: 35, columnNumber: 79, isNative: false, isEval: false}),
  24. StackFrame({functionName: 'Bar', fileName: 'https://cdn.somewherefast.com/utils.min.js', lineNumber: 1, columnNumber: 832, isNative: false, isEval: false, isConstructor: true}),
  25. StackFrame(... and so on ...)
  26. ]
  27. ```
  28. ## Installation
  29. ```bash
  30. npm install error-stack-parser
  31. bower install error-stack-parser
  32. https://raw.githubusercontent.com/stacktracejs/error-stack-parser/master/dist/error-stack-parser.min.js
  33. ```
  34. ## Contributing
  35. Want to be listed as a *Contributor*? Start with the [Contributing Guide](.github/CONTRIBUTING.md)!