{"action":"created","issue":{"url":"https://api.github.com/repos/stacktracejs/stacktrace.js/issues/142","labels_url":"https://api.github.com/repos/stacktracejs/stacktrace.js/issues/142/labels{/name}","comments_url":"https://api.github.com/repos/stacktracejs/stacktrace.js/issues/142/comments","events_url":"https://api.github.com/repos/stacktracejs/stacktrace.js/issues/142/events","html_url":"https://github.com/stacktracejs/stacktrace.js/issues/142","id":116976084,"number":142,"title":"How to print \"stack trace\" within window.onerror using stacktrace.js?","user":{"login":"kiwenlau","id":10240841,"avatar_url":"https://avatars.githubusercontent.com/u/10240841?v=3","gravatar_id":"","url":"https://api.github.com/users/kiwenlau","html_url":"https://github.com/kiwenlau","followers_url":"https://api.github.com/users/kiwenlau/followers","following_url":"https://api.github.com/users/kiwenlau/following{/other_user}","gists_url":"https://api.github.com/users/kiwenlau/gists{/gist_id}","starred_url":"https://api.github.com/users/kiwenlau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kiwenlau/subscriptions","organizations_url":"https://api.github.com/users/kiwenlau/orgs","repos_url":"https://api.github.com/users/kiwenlau/repos","events_url":"https://api.github.com/users/kiwenlau/events{/privacy}","received_events_url":"https://api.github.com/users/kiwenlau/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-15T06:14:50Z","updated_at":"2015-11-17T05:19:09Z","closed_at":null,"body":"I want to use window.onerror to track uncaught error. And I want to print \"stack trace\" like this:\r\n\r\n```\r\nReferenceError: aler is not defined\r\n    at a (http://localhost:8080/test/test01.js:21:2)\r\n    at b (http://localhost:8080/test/test01.js:25:3)\r\n    at c (http://localhost:8080/test/test01.js:29:3)\r\n    at http://localhost:8080/test/test01.js:32:1\r\n```\r\n\r\nHow can I print it within.onerror using stacktrace.js?\r\n\r\n\r\nFollowing code does't work...\r\n\r\n**onerror.js**\r\n```js\r\nwindow.onerror = function(msg, file, line, col, error) {\r\n    \r\n    function callback (result) {\r\n    \tconsole.log(result);\r\n    }\r\n\r\n    function errback (error) {\r\n    }\r\n\r\n    StackTrace.fromError(error).then(callback).catch(errback);\r\n};\r\n```\r\n\r\nFor your information, following are my html and javascript file used for test.\r\n\r\n**test.html**\r\n```html\r\n<!DOCTYPE html>\r\n<html lang=\"en\">\r\n\r\n<head>\r\n    <meta charset=\"UTF-8\">\r\n    <title>Test</title>\r\n    <script src=\"stacktrace.js\"></script>\r\n    <script src=\"onerror.js\"></script>\r\n    <script src=\"test.js\"></script>\r\n</head>\r\n\r\n<body>\r\n    Test\r\n</body>\r\n\r\n</html>\r\n```\r\n\r\n**test.js**\r\n```js\r\nfunction a() {\r\n\taler(hello);\r\n}\r\n\r\nfunction b() {\r\n  a();\r\n}\r\n\r\nfunction c() {\r\n  b();\r\n}\r\n\r\nc();\r\n```"},"comment":{"url":"https://api.github.com/repos/stacktracejs/stacktrace.js/issues/comments/157272183","html_url":"https://github.com/stacktracejs/stacktrace.js/issues/142#issuecomment-157272183","issue_url":"https://api.github.com/repos/stacktracejs/stacktrace.js/issues/142","id":157272183,"user":{"login":"eriwen","id":51534,"avatar_url":"https://avatars.githubusercontent.com/u/51534?v=3","gravatar_id":"","url":"https://api.github.com/users/eriwen","html_url":"https://github.com/eriwen","followers_url":"https://api.github.com/users/eriwen/followers","following_url":"https://api.github.com/users/eriwen/following{/other_user}","gists_url":"https://api.github.com/users/eriwen/gists{/gist_id}","starred_url":"https://api.github.com/users/eriwen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eriwen/subscriptions","organizations_url":"https://api.github.com/users/eriwen/orgs","repos_url":"https://api.github.com/users/eriwen/repos","events_url":"https://api.github.com/users/eriwen/events{/privacy}","received_events_url":"https://api.github.com/users/eriwen/received_events","type":"User","site_admin":false},"created_at":"2015-11-17T05:19:09Z","updated_at":"2015-11-17T05:19:09Z","body":"Could you be more specific when you say it \"doesn't work\"? Does it throw an Error, do nothing, or something else? \r\n\r\nI notice that you are using \"stacktrace.js\". Perhaps you're not using \"dist/stacktrace.min.js\" which has dependencies bundled? That is a source of confusion we have corrected recently."}}