René's URL Explorer Experiment


Title: [Feature Request] Flexible Error/Exception handling · Issue #5914 · NativeScript/NativeScript · GitHub

Open Graph Title: [Feature Request] Flexible Error/Exception handling · Issue #5914 · NativeScript/NativeScript

X Title: [Feature Request] Flexible Error/Exception handling · Issue #5914 · NativeScript/NativeScript

Description: The Problem Currently, when an unhandled exception is thrown in NativeScript (inside app-code, core-modules or plugins) it will (in most) cases crash the application showing the error and stack trace. When in development - in many cases ...

Open Graph Description: The Problem Currently, when an unhandled exception is thrown in NativeScript (inside app-code, core-modules or plugins) it will (in most) cases crash the application showing the error and stack tra...

X Description: The Problem Currently, when an unhandled exception is thrown in NativeScript (inside app-code, core-modules or plugins) it will (in most) cases crash the application showing the error and stack tra...

Opengraph URL: https://github.com/NativeScript/NativeScript/issues/5914

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Feature Request] Flexible Error/Exception handling","articleBody":"## The Problem\r\nCurrently, when an unhandled exception is thrown in NativeScript (inside app-code, core-modules or plugins) it will (in most) cases crash the application showing the error and stack trace. \r\n\r\nWhen in **development** - in many cases this is what you'd expect. You would want to have the stack-trace of the exact location the unexpected behavior has occurred, so that you can more easily understand what happened and fix it.\r\n\r\nHowever, in **production**, an application crash can seriously hurt you application credibility and drive away customers. In many cases you might prefer anything else (app freeze, blank screen, failed navigation etc.) to an actual crash with an error log. There are even cases, in whitch the application will recover and will work OK even if something unexpected has happened - for exampled failed animation or a typo in CSS property.\r\n\r\n## Proposal\r\n\r\nThe aim of this FR is to propose an API that provides a way to handle errors in different ways in development and in production. It should provide flexibility to configure how errors should be handled. For example:\r\n\r\n1. _(development 1)_ Throw exceptions as soon as error occurs.\r\n2. _(development 2)_ Show a scary `console.log` with `ERROR: Something bad happened` but continue execution of the app. You will see it in you terminal, but decide if it is critical based on what happens with the app after that.\r\n3. _(production)_ Send an error report to your analytics/error-report server, but continue app execution. Maybe triggers some recover logic that will handle the app without a crash. \r\n\r\n### API Proposal\r\nExtend the `trace` module with an `error()` method. \r\n\r\nUse the method in core-framework/plugins/app code:\r\n```\r\nfunction doSomething(arg) {\r\n  // Instead of   \r\n  if(!arg) throw new Error(\"Arg not provided in \"doSomething\");\r\n  \r\n  // Use trace.error()\r\n  if(!arg) {\r\n    trace.error(\"Arg not provided in \"doSomething\");\r\n    return;\r\n  }\r\n  // ... implementation using arg\r\n}\r\n```\r\n\r\nDevelopers can define custom error handler logic (probably on app startup):\r\n\r\n```\r\nconst errorHandler: ErrorHandler = {\r\n    handleError(err){\r\n        //(development 1)\r\n        throw err;\r\n\r\n        //(development 2)\r\n        trace.write(err, \"unhandlede-error\", type.error);\r\n\r\n        //(production)\r\n        reportToAnalytics(err)\r\n    }\r\n}\r\n\r\ntrace.setErrorHandler(errorHandler)\r\n```\r\n\r\n### Next Steps\r\n\r\n- [x] Gather FB on this proposal and implement it in the `tns-core-modules`.\r\n- [x] Create a comprehensive guide on how to use the error API in the [contributing.md](https://github.com/NativeScript/NativeScript/blob/master/CONTRIBUTING.md).  **Update**: [here](https://github.com/NativeScript/NativeScript/blob/master/HandlingErrors.md) it is.\r\n- [x] Require all PRs to follow the guide and handle errors in a similar fashion\r\n- [x] _(ongoing)_ Gradually refactor most problematic areas of the codebase to use comply with the guides and use this approach (PRs will be welcome).\r\n \r\n\r\nPing @NathanWalker @EddyVerbruggen ","author":{"url":"https://github.com/vakrilov","@type":"Person","name":"vakrilov"},"datePublished":"2018-06-05T11:47:56.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/5914/NativeScript/issues/5914"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:a5249f46-85f3-04cd-ed7d-0d587253bd91
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idEA0A:AA33E:13C6F4:1A028D:6A5FE7B2
html-safe-nonce3d6816f5cac213eec8bf26b253448624fa8013559a6fbcfd9bdbe8b721c8083f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTBBOkFBMzNFOjEzQzZGNDoxQTAyOEQ6NkE1RkU3QjIiLCJ2aXNpdG9yX2lkIjoiNDMzNzkwMDY1ODQ1ODg3OTkyMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac27fdd1d6a56d5add4de36fdefa610618059f2c976a3e000f64a5d4cc8bb11f56
hovercard-subject-tagissue:329420155
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/NativeScript/NativeScript/5914/issue_layout
twitter:imagehttps://opengraph.githubassets.com/e9880e8ee8eaa6cc206592dac999ae3bdf66d637e994258ad3a9632f86dd039e/NativeScript/NativeScript/issues/5914
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/e9880e8ee8eaa6cc206592dac999ae3bdf66d637e994258ad3a9632f86dd039e/NativeScript/NativeScript/issues/5914
og:image:altThe Problem Currently, when an unhandled exception is thrown in NativeScript (inside app-code, core-modules or plugins) it will (in most) cases crash the application showing the error and stack tra...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamevakrilov
hostnamegithub.com
expected-hostnamegithub.com
None78938542173c0d8e4ad1aefc7954896e81c10ce2620286603ef14cf593bd5a11
turbo-cache-controlno-preview
go-importgithub.com/NativeScript/NativeScript git https://github.com/NativeScript/NativeScript.git
octolytics-dimension-user_id7392261
octolytics-dimension-user_loginNativeScript
octolytics-dimension-repository_id31492490
octolytics-dimension-repository_nwoNativeScript/NativeScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id31492490
octolytics-dimension-repository_network_root_nwoNativeScript/NativeScript
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
release1a427601e09953033b696253e754ebc7328096a7
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/NativeScript/NativeScript/issues/5914#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2FNativeScript%2Fissues%2F5914
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
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
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
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
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
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/enterprise/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://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2FNativeScript%2Fissues%2F5914
Sign up https://github.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=NativeScript%2FNativeScript
Reloadhttps://github.com/NativeScript/NativeScript/issues/5914
Reloadhttps://github.com/NativeScript/NativeScript/issues/5914
Reloadhttps://github.com/NativeScript/NativeScript/issues/5914
Please reload this pagehttps://github.com/NativeScript/NativeScript/issues/5914
NativeScript https://github.com/NativeScript
NativeScripthttps://github.com/NativeScript/NativeScript
Please reload this pagehttps://github.com/NativeScript/NativeScript/issues/5914
Notifications https://github.com/login?return_to=%2FNativeScript%2FNativeScript
Fork 1.7k https://github.com/login?return_to=%2FNativeScript%2FNativeScript
Star 25.6k https://github.com/login?return_to=%2FNativeScript%2FNativeScript
Code https://github.com/NativeScript/NativeScript
Issues 771 https://github.com/NativeScript/NativeScript/issues
Pull requests 69 https://github.com/NativeScript/NativeScript/pulls
Discussions https://github.com/NativeScript/NativeScript/discussions
Actions https://github.com/NativeScript/NativeScript/actions
Projects https://github.com/NativeScript/NativeScript/projects
Wiki https://github.com/NativeScript/NativeScript/wiki
Security and quality 0 https://github.com/NativeScript/NativeScript/security
Insights https://github.com/NativeScript/NativeScript/pulse
Code https://github.com/NativeScript/NativeScript
Issues https://github.com/NativeScript/NativeScript/issues
Pull requests https://github.com/NativeScript/NativeScript/pulls
Discussions https://github.com/NativeScript/NativeScript/discussions
Actions https://github.com/NativeScript/NativeScript/actions
Projects https://github.com/NativeScript/NativeScript/projects
Wiki https://github.com/NativeScript/NativeScript/wiki
Security and quality https://github.com/NativeScript/NativeScript/security
Insights https://github.com/NativeScript/NativeScript/pulse
[Feature Request] Flexible Error/Exception handlinghttps://github.com/NativeScript/NativeScript/issues/5914#top
https://github.com/vakrilov
4.2.0https://github.com/NativeScript/NativeScript/milestone/40
https://github.com/vakrilov
vakrilovhttps://github.com/vakrilov
on Jun 5, 2018https://github.com/NativeScript/NativeScript/issues/5914#issue-329420155
contributing.mdhttps://github.com/NativeScript/NativeScript/blob/master/CONTRIBUTING.md
herehttps://github.com/NativeScript/NativeScript/blob/master/HandlingErrors.md
@NathanWalkerhttps://github.com/NathanWalker
@EddyVerbruggenhttps://github.com/EddyVerbruggen
vakrilovhttps://github.com/vakrilov
4.2.0https://github.com/NativeScript/NativeScript/milestone/40
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.