Installations
npm install error-callsites
Releases
Unable to fetch releases
Developer
watson
Developer Guide
Module System
CommonJS
Min. Node Version
>=6.x
Typescript Support
No
Node Version
12.22.1
NPM Version
6.14.12
Statistics
7 Stars
36 Commits
1 Forks
3 Watching
1 Branches
4 Contributors
Updated on 03 Jul 2024
Bundle Size
947.00 B
Minified
477.00 B
Minified + Gzipped
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
52,561,277
Last day
-4%
56,695
Compared to previous day
Last week
3.8%
313,365
Compared to previous week
Last month
1.3%
1,324,947
Compared to previous month
Last year
19.6%
15,063,577
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
error-callsites
Yet another module for extracting callsites (a.k.a. stack-frames) from
Node.js Error
objects.
Installation
npm install error-callsites
Usage
1var callsites = require('error-callsites') 2 3var err = new Error('foo') 4var frames = callsites(err) 5 6console.log('Error occurred on line', frames[0].getLineNumber())
API
The module exposes a single function which expects an Error
object as
the first argument:
1var frames = callsites(err)
More specifically, it expects an object on which Error.captureStackTrace(obj)
has been called, which is the case for Error
objects. You can do it directly
yourself:
1var obj = {} 2Error.captureStackTrace(obj) 3var frames = callsites(err)
The function returns an array of
v8 CallSite
objects
-- one for each frame in the stack trace. CallSite objects provide accessor
methods for information on that frame. For example:
callsite.getThis()
- returns the value of thiscallsite.getTypeName()
- returns the type of this as a string. This is the name of the function stored in the constructor field of this, if available, otherwise the object's [[Class]] internal property.callsite.getFunction()
- returns the current functioncallsite.getFunctionName()
- returns the name of the current function, typically its name property. If a name property is not available an attempt will be made to try to infer a name from the function's context.callsite.getMethodName()
- returns the name of the property of this or one of its prototypes that holds the current functioncallsite.getFileName()
- if this function was defined in a script returns the name of the scriptcallsite.getLineNumber()
- if this function was defined in a script returns the current line numbercallsite.getColumnNumber()
- if this function was defined in a script returns the current column numbercallsite.getEvalOrigin()
- if this function was created using a call to eval returns a CallSite object representing the location where eval was calledcallsite.isToplevel()
- is this a toplevel invocation, that is, is this the global object?callsite.isEval()
- does this call take place in code defined by a call to eval?callsite.isNative()
- is this call in native V8 code?callsite.isConstructor()
- is this a constructor call?
See the link above for a complete list of the accessor methods. Some have been added in more recent versions of v8 and Node.js.
How it works
This package works by setting a custom Error.prepareStackTrace
property that transparently captures the structured stack trace that v8 passes
to this API, while also supporting other Node.js code in the process setting
its own Error.prepareStackTrace
.
License
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/watson/error-callsites/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/watson/error-callsites/test.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/test.yml:27
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/test.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 2 are checked with a SAST tool
Score
3.4
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More