René's URL Explorer Experiment


Title: SyntaxError stack trace not generated · Issue #81 · stacktracejs/error-stack-parser · GitHub

Open Graph Title: SyntaxError stack trace not generated · Issue #81 · stacktracejs/error-stack-parser

X Title: SyntaxError stack trace not generated · Issue #81 · stacktracejs/error-stack-parser

Description: Current Behavior We have detected a problem when generating stack trace from a SyntaxError. This takes place when the error cause is due to a malformed javascript code, the output of the library is not consistent: On chromium browsers it...

Open Graph Description: Current Behavior We have detected a problem when generating stack trace from a SyntaxError. This takes place when the error cause is due to a malformed javascript code, the output of the library is...

X Description: Current Behavior We have detected a problem when generating stack trace from a SyntaxError. This takes place when the error cause is due to a malformed javascript code, the output of the library is...

Opengraph URL: https://github.com/stacktracejs/error-stack-parser/issues/81

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"SyntaxError stack trace not generated","articleBody":"## Current Behavior\r\n\r\nWe have detected a problem when generating stack trace from a SyntaxError. This takes place when the error cause is due to a **malformed javascript code**, the output of the library is not consistent:\r\n\r\n- On chromium browsers it returns a malformed single stack trace element not containing the lineNumber property\r\n\r\n\u003cimg width=\"639\" alt=\"Screenshot 2022-06-15 at 14 46 00\" src=\"https://user-images.githubusercontent.com/15065076/173830214-cdcb3ed3-d6fd-4841-9793-53916d632896.png\"\u003e\r\n\r\n- On non-chromium browsers it throws an exception.\r\n\r\n\u003cimg width=\"388\" alt=\"Screenshot 2022-06-15 at 14 49 36\" src=\"https://user-images.githubusercontent.com/15065076/173830896-de799971-df1e-46d3-8c3e-f147f4bacf4f.png\"\u003e\r\n\r\n## Expected Behavior\r\nWe would expect one the following two behaviours, being **number 2** the preferred:\r\n\r\n1. Consistency across all browsers. In this case, we would expect the exception on all of them.\r\n2. Handle this case and return a well formed single stack trace element, for example:\r\n\r\n\u003cimg width=\"516\" alt=\"Screenshot 2022-06-15 at 15 31 58\" src=\"https://user-images.githubusercontent.com/15065076/173839759-e15f1f93-2914-43c7-9a0c-8738c16bc614.png\"\u003e\r\n\r\n## Steps to Reproduce (for bugs)\r\n\r\nThe code below reproduces the issue:\r\n\r\n```\r\n\u003chtml\u003e\r\n    \u003chead\u003e\r\n        \u003ctitle\u003eInline errors page test\u003c/title\u003e\r\n    \u003c/head\u003e\r\n    \u003cbody\u003e\r\n        \u003ch1\u003eInline errors page test\u003c/h1\u003e\r\n        \u003cscript type=\"text/javascript\" src=\"error-stack-parser.js\"\u003e\u003c/script\u003e\r\n        \u003cscript\u003e\r\n            window.addEventListener(\"error\", (errorEvent) =\u003e {\r\n                const stack = ErrorStackParser.parse(errorEvent.error)\r\n                console.log(\"stack\", stack);\r\n            })\r\n        \u003c/script\u003e\r\n        \u003cscript\u003e\r\n            var a: // the malformed javascript here\r\n        \u003c/script\u003e\r\n    \u003c/body\u003e\r\n\u003c/html\u003e\r\n```\r\n**Important**: A SyntaxError generated from a bad usage of a API like JSON.parse does not reproduce the issue\r\n```\r\n\u003chtml\u003e\r\n    \u003chead\u003e\r\n        \u003ctitle\u003eInline errors page test\u003c/title\u003e\r\n    \u003c/head\u003e\r\n    \u003cbody\u003e\r\n        \u003ch1\u003eInline errors page test\u003c/h1\u003e\r\n        \u003cscript type=\"text/javascript\" src=\"error-stack-parser.js\"\u003e\u003c/script\u003e\r\n        \u003cscript\u003e\r\n            window.addEventListener(\"error\", (errorEvent) =\u003e {\r\n                const stack = ErrorStackParser.parse(errorEvent.error);\r\n                console.log(\"stack\", stack);\r\n            })\r\n        \u003c/script\u003e\r\n        \u003cscript\u003e\r\n            JSON.parse('\u003cI am not a json\u003e') --\u003e wrong input\r\n        \u003c/script\u003e\r\n    \u003c/body\u003e\r\n\u003c/html\u003e\r\n```\r\n\r\n## Context\r\n\u003c!--- How has this issue affected you? What are you trying to accomplish? --\u003e\r\n\u003c!--- Providing context helps us come up with a solution that is most useful in the real world --\u003e\r\n\r\n## Your Environment\r\nThis happens on all versions of the library (including the latest one). \r\nTested on different OS, such as MacOS, Fedora Linux, and Windows 10\r\n\r\n## Possible Solution\r\nIt seems that the [parse](https://github.com/stacktracejs/error-stack-parser/blob/master/error-stack-parser.js#L28,L35) function it might be the good place to start with the fix. Presumably, there is new condition to be added or a change on the regex that needs to be done, or both. \r\nOn Chromium browsers the line [return this.parseFFOrSafari(error);](https://github.com/stacktracejs/error-stack-parser/blob/master/error-stack-parser.js#L33) is the one being executed, which is wrong.\r\n\r\nOn our product we have followed a defensive approach to overcome the issue:\r\n\r\nWe leverage the information available in [ErrorEvent](https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent). So, if the library throws an exception or generates a malformed stack trace what we do is to extract **lineno**, **colno**, and **filename** from such event.","author":{"url":"https://github.com/devcorpio","@type":"Person","name":"devcorpio"},"datePublished":"2022-06-15T14:13:46.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/81/error-stack-parser/issues/81"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:b15ab17a-7a83-b8bd-7295-e5e4e0f08009
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idBCCC:1F4A08:8E51EE:C6B542:696F3C79
html-safe-nonce95ab0760fe8a268985e46a7545c6c3209b7dfcd08502e7e73d31028d44cb5a14
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQ0NDOjFGNEEwODo4RTUxRUU6QzZCNTQyOjY5NkYzQzc5IiwidmlzaXRvcl9pZCI6IjM2NDE2MjU4NzQ5NTI4MzAwNzMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacdc6e79e9c2d6194c15524d71a48e905664dbbf8961cf9751e335e839ed6de303
hovercard-subject-tagissue:1272302696
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/stacktracejs/error-stack-parser/81/issue_layout
twitter:imagehttps://opengraph.githubassets.com/1c46f2b49c329ef0fd7e85676d7f3ac4d566a32463aea457355053d233ea3223/stacktracejs/error-stack-parser/issues/81
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/1c46f2b49c329ef0fd7e85676d7f3ac4d566a32463aea457355053d233ea3223/stacktracejs/error-stack-parser/issues/81
og:image:altCurrent Behavior We have detected a problem when generating stack trace from a SyntaxError. This takes place when the error cause is due to a malformed javascript code, the output of the library is...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedevcorpio
hostnamegithub.com
expected-hostnamegithub.com
Noneb278ad162d35332b6de714dfb005de04386c4d92df6475522bef910f491a35ee
turbo-cache-controlno-preview
go-importgithub.com/stacktracejs/error-stack-parser git https://github.com/stacktracejs/error-stack-parser.git
octolytics-dimension-user_id6131251
octolytics-dimension-user_loginstacktracejs
octolytics-dimension-repository_id15014773
octolytics-dimension-repository_nwostacktracejs/error-stack-parser
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id15014773
octolytics-dimension-repository_network_root_nwostacktracejs/error-stack-parser
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release39aed5006635ab6f45e6b77d23e73b08a00272a3
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/stacktracejs/error-stack-parser/issues/81#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fstacktracejs%2Ferror-stack-parser%2Fissues%2F81
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fstacktracejs%2Ferror-stack-parser%2Fissues%2F81
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=stacktracejs%2Ferror-stack-parser
Reloadhttps://patch-diff.githubusercontent.com/stacktracejs/error-stack-parser/issues/81
Reloadhttps://patch-diff.githubusercontent.com/stacktracejs/error-stack-parser/issues/81
Reloadhttps://patch-diff.githubusercontent.com/stacktracejs/error-stack-parser/issues/81
stacktracejs https://patch-diff.githubusercontent.com/stacktracejs
error-stack-parserhttps://patch-diff.githubusercontent.com/stacktracejs/error-stack-parser
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fstacktracejs%2Ferror-stack-parser
Fork 51 https://patch-diff.githubusercontent.com/login?return_to=%2Fstacktracejs%2Ferror-stack-parser
Star 483 https://patch-diff.githubusercontent.com/login?return_to=%2Fstacktracejs%2Ferror-stack-parser
Code https://patch-diff.githubusercontent.com/stacktracejs/error-stack-parser
Issues 14 https://patch-diff.githubusercontent.com/stacktracejs/error-stack-parser/issues
Pull requests 9 https://patch-diff.githubusercontent.com/stacktracejs/error-stack-parser/pulls
Actions https://patch-diff.githubusercontent.com/stacktracejs/error-stack-parser/actions
Security Uh oh! There was an error while loading. Please reload this page. https://patch-diff.githubusercontent.com/stacktracejs/error-stack-parser/security
Please reload this pagehttps://patch-diff.githubusercontent.com/stacktracejs/error-stack-parser/issues/81
Insights https://patch-diff.githubusercontent.com/stacktracejs/error-stack-parser/pulse
Code https://patch-diff.githubusercontent.com/stacktracejs/error-stack-parser
Issues https://patch-diff.githubusercontent.com/stacktracejs/error-stack-parser/issues
Pull requests https://patch-diff.githubusercontent.com/stacktracejs/error-stack-parser/pulls
Actions https://patch-diff.githubusercontent.com/stacktracejs/error-stack-parser/actions
Security https://patch-diff.githubusercontent.com/stacktracejs/error-stack-parser/security
Insights https://patch-diff.githubusercontent.com/stacktracejs/error-stack-parser/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/stacktracejs/error-stack-parser/issues/81
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/stacktracejs/error-stack-parser/issues/81
SyntaxError stack trace not generatedhttps://patch-diff.githubusercontent.com/stacktracejs/error-stack-parser/issues/81#top
a:bughttps://github.com/stacktracejs/error-stack-parser/issues?q=state%3Aopen%20label%3A%22a%3Abug%22
https://github.com/devcorpio
https://github.com/devcorpio
devcorpiohttps://github.com/devcorpio
on Jun 15, 2022https://github.com/stacktracejs/error-stack-parser/issues/81#issue-1272302696
https://user-images.githubusercontent.com/15065076/173830214-cdcb3ed3-d6fd-4841-9793-53916d632896.png
https://user-images.githubusercontent.com/15065076/173830896-de799971-df1e-46d3-8c3e-f147f4bacf4f.png
https://user-images.githubusercontent.com/15065076/173839759-e15f1f93-2914-43c7-9a0c-8738c16bc614.png
parsehttps://github.com/stacktracejs/error-stack-parser/blob/master/error-stack-parser.js#L28,L35
return this.parseFFOrSafari(error);https://github.com/stacktracejs/error-stack-parser/blob/master/error-stack-parser.js#L33
ErrorEventhttps://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent
a:bughttps://github.com/stacktracejs/error-stack-parser/issues?q=state%3Aopen%20label%3A%22a%3Abug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.