Created
January 9, 2015 03:51
Revisions
-
iwillig created this gist
Jan 9, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ <!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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ # 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()