Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
- io.js 3.x
- Node.js 4.x
- Node.js 5.x
- Node.js 5.x with core-js polyfill
- Node.js 6.x
- Node.js 7.x
- Node.js 8.x
Expand Down Expand Up @@ -63,6 +64,11 @@ jobs:
node-version: "5.12"
npm-i: browserify@15 [email protected] [email protected]

- name: Node.js 5.x with core-js polyfill
node-version: "5.12"
npm-i: browserify@15 [email protected] [email protected] core-js@3
ENABLE_COREJS_ERROR_POLYFILL: true

- name: Node.js 6.x
node-version: "6.17"
npm-i: browserify@15 [email protected] [email protected]
Expand Down Expand Up @@ -158,6 +164,8 @@ jobs:

- name: Run tests
shell: bash
env:
ENABLE_COREJS_ERROR_POLYFILL: ${{ matrix.ENABLE_COREJS_ERROR_POLYFILL }}
run: |
if npm -ps ls nyc | grep -q nyc; then
npm run test-ci
Expand Down
34 changes: 22 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,19 +265,23 @@ function log (message, site) {
*/

function callSiteLocation (callSite) {
var file = callSite.getFileName() || '<anonymous>'
var line = callSite.getLineNumber()
var colm = callSite.getColumnNumber()

if (callSite.isEval()) {
file = callSite.getEvalOrigin() + ', ' + file
var site
if (callSite) {
var file = callSite.getFileName() || '<anonymous>'
var line = callSite.getLineNumber()
var colm = callSite.getColumnNumber()
if (callSite.isEval()) {
file = callSite.getEvalOrigin() + ', ' + file
}
site = [file, line, colm]
site.callSite = callSite
site.name = callSite.getFunctionName()
} else {
site = ['<unknown file>', '<unknown line>', '<unknown column>']
site.callSite = {}
site.callSite.getThis = function () { return null }
site.name = '<unknown function>'
}

var site = [file, line, colm]

site.callSite = callSite
site.name = callSite.getFunctionName()

return site
}

Expand Down Expand Up @@ -389,6 +393,12 @@ function getStack () {
// capture the stack
Error.captureStackTrace(obj)

if (typeof obj.stack === 'string' || obj.stack instanceof String) {
// Means that prepareObjectStackTrace failed, obj.stack is not a CallSite array.
// We fallback to returning an empty array.
return []
}

// slice this function off the top
var stack = obj.stack.slice(1)

Expand Down
Loading