Created
January 9, 2015 03:51
-
-
Save iwillig/c1dafb43cb8cf06e2dbf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<script src="/node_modules/source-map/dist/source-map.js"></script> | |
<script src="/web-worker-report.js"></script> | |
<script> | |
var worker = new Worker('test.js'); | |
worker.onerror = function(e) { | |
reportError(e); | |
}; | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetchSourceMap = (fileName) => | |
response = null | |
xhr = new XMLHttpRequest() | |
xhr.onreadystatechange = () => | |
if xhr.readyState == 4 and xhr.status == 200 | |
response = xhr.responseText | |
xhr.onerror = (error) => | |
throw error | |
xhr.open('GET', fileName + '.map', false) | |
xhr.send() | |
response | |
window.reportError = (error) => | |
lineNumber = error.lineno | |
columnNumber = error.colno | |
rawSourceMap = fetchSourceMap error.filename | |
smc = new sourceMap.SourceMapConsumer rawSourceMap | |
console.log smc.originalPositionFor { line: error.lineno, column: error.colno } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this | |
# is | |
# a bunch of | |
# space | |
# more code | |
fib = (n) => | |
if n <= 2 | |
1 | |
fib(n - 1) + fib(n - 2) | |
throwError = -> throw new Error('hello world') | |
throwError() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment