Merge pull request #4414 from atom/mb-convert-stack-trace

Fix line numbers in coffeescript stack traces for error hooks
This commit is contained in:
Max Brunsfeld 2014-12-05 14:06:22 -08:00
commit 11a07f41ac

View File

@ -11,6 +11,7 @@ _ = require 'underscore-plus'
{Emitter} = require 'event-kit'
{Model} = require 'theorist'
fs = require 'fs-plus'
{convertStackTrace, convertLine} = require 'coffeestack'
{$} = require './space-pen-extensions'
WindowEventHandler = require './window-event-handler'
@ -198,9 +199,16 @@ class Atom extends Model
unless @inDevMode() or @inSpecMode()
require('grim').deprecate = ->
sourceMapCache = {}
window.onerror = =>
@lastUncaughtError = Array::slice.call(arguments)
[message, url, line, column, originalError] = @lastUncaughtError
convertedLine = convertLine(url, line, column, sourceMapCache)
{line, column} = convertedLine if convertedLine?
originalError.stack = convertStackTrace(originalError.stack, sourceMapCache) if originalError
eventObject = {message, url, line, column, originalError}
openDevTools = true