🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

error-position

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

error-position

根据js常见错误堆栈字符串和sourceMap文件路径定位错误位置

latest
Source
npmnpm
Version
1.0.5
Version published
Weekly downloads
4
-71.43%
Maintainers
1
Weekly downloads
 
Created
Source

errorPosition

根据 js 错误堆栈字符串和 sourceMap 文件定位错误位置

Usage

例如:代码中抛出这样的错误:

try {
  throw new EvalError('Hello');
} catch (e) {
  console.log(e.stack);               
}

输入:错误堆栈 e.stack 字符串,sourcemap文件路径E:\\code\\dist

输出:错误在源代码中所在位置、行数、列数、报错行代码等信息

安装:npm install --save error-position

const errorPosition = require("error-position");

let result = errorPosition(`EvalError: Hello    
    at Object.<anonymous> (/Users/file/errorPosition/index.js:4:9)    
    at Module._compile (internal/modules/cjs/loader.js:1155:14)    
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)    
    at Module.load (internal/modules/cjs/loader.js:1002:32)    
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)    
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)    
    at internal/main/run_main_module.js:18:47
    `, 
    'E:\\code\\dist')

Keywords

error

FAQs

Package last updated on 10 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts