Skip to content

Commit

Permalink
IE error caught
Browse files Browse the repository at this point in the history
  • Loading branch information
lsimone committed Apr 16, 2018
1 parent 90cd166 commit 8907760
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
* above `fn()` in the call stack. `getCaller()` without arguments will return the name of the direct caller function.
*/
export function getCaller (stackJump = 0) {
const caller = new Error().stack
.split(/\r?\n/)[stackJump + 3]

return caller && caller
.replace(/\s*at\s*/, '')
try {
return new Error().stack
.split(/\r?\n/)[stackJump + 3]
.replace(/\s*at\s*/, '')
} catch (e) {
console.log('getCaller() not possible')
}
}

export function mapValues (obj, mapFn) {
Expand Down

0 comments on commit 8907760

Please sign in to comment.