Skip to content

Commit

Permalink
fix: error only stacks
Browse files Browse the repository at this point in the history
  • Loading branch information
borela authored and mxlje committed Jun 14, 2017
1 parent c26e255 commit e4573a1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ export class RedBoxError extends Component {
mapOnConstruction(error) {
const stackLines = error.stack.split('\n')

// There's no stack, only the error message.
if (stackLines.length < 2) {
this.state = { error, mapped: true }
return
}

// Using the “eval” setting on webpack already gives the correct location.
const isWebpackEval = stackLines[1].search(/\(webpack:\/{3}/) !== -1
if (isWebpackEval) {
Expand Down

0 comments on commit e4573a1

Please sign in to comment.