mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
fix bug in getRawStack
This commit is contained in:
@@ -159,24 +159,23 @@ require('source-map-support').install({
|
||||
})
|
||||
|
||||
var sourceMapPrepareStackTrace = Error.prepareStackTrace
|
||||
var prepareStackTrace = sourceMapPrepareStackTrace
|
||||
|
||||
// Enable Grim to access the raw stack by customizing Error.prepareStackTrace
|
||||
function prepareStackTraceWithRawStack (error, frames) {
|
||||
error.rawStack = frames
|
||||
return sourceMapPrepareStackTrace(error, frames)
|
||||
}
|
||||
|
||||
// Prevent coffee-script from reassigning Error.prepareStackTrace
|
||||
Object.defineProperty(Error, 'prepareStackTrace', {
|
||||
get: function () { return prepareStackTrace },
|
||||
get: function () { return prepareStackTraceWithRawStack },
|
||||
set: function (newValue) {}
|
||||
})
|
||||
|
||||
// Enable Grim to access the raw stack without reassigning Error.prepareStackTrace
|
||||
Error.prototype.getRawStack = function () { // eslint-disable-line no-extend-native
|
||||
prepareStackTrace = getRawStack
|
||||
var result = this.stack
|
||||
prepareStackTrace = sourceMapPrepareStackTrace
|
||||
return result
|
||||
}
|
||||
|
||||
function getRawStack (_, stack) {
|
||||
return stack
|
||||
// Call this.stack first to ensure rawStack is generated
|
||||
this.stack
|
||||
return this.rawStack
|
||||
}
|
||||
|
||||
Object.keys(COMPILERS).forEach(function (extension) {
|
||||
|
||||
Reference in New Issue
Block a user