Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add source-mapped stacktrace to error message in web UI #13082

Merged
merged 2 commits into from
Feb 19, 2020

Conversation

ClearlyClaire
Copy link
Contributor

  • Add source-mapped stack trace to the copyable text using stacktrace-js. As it doesn't seem extremely reliable, add the parsed stacktrace instead of replacing it.
  • Add the textual representation of the error itself as it is not included in the stack trace in Firefox

It seems to work with both recent Firefox and Chromium versions, with some oddities in Firefox.

Example on Firefox

The exception itself is caused by an added throw Error('foo') in status.js for testing purposes.
Before the patch, only the first stack trace is reported, without the leading “Error: foo”.

Error: foo


render@https://mastodev-data.sitedethib.com/packs/js/common-390aee448debf63978f5.js:25056:3955
vi@https://mastodev-data.sitedethib.com/packs/js/common-390aee448debf63978f5.js:48120:76
ui@https://mastodev-data.sitedethib.com/packs/js/common-390aee448debf63978f5.js:48111:10
gk@https://mastodev-data.sitedethib.com/packs/js/common-390aee448debf63978f5.js:50553:86
fk@https://mastodev-data.sitedethib.com/packs/js/common-390aee448debf63978f5.js:49527:13
Zj@https://mastodev-data.sitedethib.com/packs/js/common-390aee448debf63978f5.js:49516:9
Lj@https://mastodev-data.sitedethib.com/packs/js/common-390aee448debf63978f5.js:49272:11
ig/<@https://mastodev-data.sitedethib.com/packs/js/common-390aee448debf63978f5.js:46708:17
exports.unstable_runWithPriority@https://mastodev-data.sitedethib.com/packs/js/common-390aee448debf63978f5.js:51529:12
fg@https://mastodev-data.sitedethib.com/packs/js/common-390aee448debf63978f5.js:46673:10
ig@https://mastodev-data.sitedethib.com/packs/js/common-390aee448debf63978f5.js:46703:9
jg@https://mastodev-data.sitedethib.com/packs/js/common-390aee448debf63978f5.js:46693:3
bk@https://mastodev-data.sitedethib.com/packs/js/common-390aee448debf63978f5.js:49313:23
notify@https://mastodev-data.sitedethib.com/packs/js/common-390aee448debf63978f5.js:7637:12
notifyNestedSubs@https://mastodev-data.sitedethib.com/packs/js/common-390aee448debf63978f5.js:7679:20
handleChangeWrapper@https://mastodev-data.sitedethib.com/packs/js/common-390aee448debf63978f5.js:7684:12
dispatch@https://mastodev-data.sitedethib.com/packs/js/common-390aee448debf63978f5.js:15431:7
soundsMiddleware/</</<@https://mastodev-data.sitedethib.com/packs/js/common-390aee448debf63978f5.js:15035:738
errorsMiddleware/</</<@https://mastodev-data.sitedethib.com/packs/js/common-390aee448debf63978f5.js:15033:344
loadingBarMiddleware/</</<@https://mastodev-data.sitedethib.com/packs/js/common-390aee448debf63978f5.js:15031:761
createThunkMiddleware/</</<@https://mastodev-data.sitedethib.com/packs/js/common-390aee448debf63978f5.js:14811:16
dispatch@https://mastodev-data.sitedethib.com/packs/js/common-390aee448debf63978f5.js:15837:28
expandTimeline/</<@https://mastodev-data.sitedethib.com/packs/js/common-390aee448debf63978f5.js:9535:2927



render (webpack:///app/javascript/mastodon/components/status.js:268:10)
vi (webpack:///node_modules/react-dom/cjs/react-dom.production.min.js:4241:)
Ug (webpack:///node_modules/react-dom/cjs/react-dom.production.min.js:4232:)
gk (webpack:///node_modules/react-dom/cjs/react-dom.production.min.js:6674:)
fk (webpack:///node_modules/react-dom/cjs/react-dom.production.min.js:5648:)
Zj (webpack:///node_modules/react-dom/cjs/react-dom.production.min.js:5637:)
Tj (webpack:///node_modules/react-dom/cjs/react-dom.production.min.js:5393:)
fg (webpack:///node_modules/react-dom/cjs/react-dom.production.min.js:2829:)
unstable_runWithPriority (webpack:///node_modules/scheduler/cjs/scheduler.production.min.js:270:)
fg (webpack:///node_modules/react-dom/cjs/react-dom.production.min.js:2794:)
fg (webpack:///node_modules/react-dom/cjs/react-dom.production.min.js:2824:)
jg (webpack:///node_modules/react-dom/cjs/react-dom.production.min.js:2814:)
bk (webpack:///node_modules/react-dom/cjs/react-dom.production.min.js:5434:)
batch(function (webpack:///node_modules/react-redux/es/utils/Subscription.js:23:)
notifyNestedSubs (webpack:///node_modules/react-redux/es/utils/Subscription.js:65:)
handleChangeWrapper (webpack:///node_modules/react-redux/es/utils/Subscription.js:70:)
currentReducer (webpack:///node_modules/redux/es/redux.js:222:)
return (webpack:///app/javascript/mastodon/middleware/sounds.js:44:11)
action.type.match (webpack:///app/javascript/mastodon/middleware/errors.js:15:11)
action.type.match (webpack:///app/javascript/mastodon/middleware/loading_bar.js:23:11)
function (webpack:///node_modules/redux-thunk/es/index.js:11:)
dispatch (webpack:///node_modules/redux/es/redux.js:640:)
compareId (webpack:///app/javascript/mastodon/actions/timelines.js:100:15)

Copy link
Sponsor Member

@ykzts ykzts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice 👍

@ClearlyClaire
Copy link
Contributor Author

Yeah I can confirm that the function names at least are sometimes completely off in Firefox (at least old versions), but files and line numbers seem ok, and no info is lost since the raw stacktrace is also available.

@Gargron Gargron changed the title Add error message and source-mapped stack to error boundary Add source-mapped stacktrace to error message in web UI Feb 19, 2020
@Gargron Gargron merged commit ff3a11d into mastodon:master Feb 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants