Comments (7)
You should be able to catch errors on bootstraping with :
bootstrapApplication(AppComponen).catch((error) => alert(error));
from angular.
@JeanMeche Would that included errors like when web-animations are not supported or some Core JS Functions are missing?
from angular.
Anything that throws an error on bootstrap.
Else you'll probably want to attach an ErrorHandler : https://angular.dev/api/core/ErrorHandler
from angular.
Note that syntax errors will prevent the script from executing at all, so you can only catch those from a different script that sets up a global error handler (a browser error handler, not Angular's error handler).
This is outside the scope of Angular as a framework, though.
from angular.
@JoostK Hi Joost, I am mainly concerned about things like lack of support for Nullish_coalescing_assignment in a browser on a TV.
That would be treated as a syntax error because that TV browser doesn't support it and would result in a white screen.
I don't think that would be caught in the bootstrap Catch function.
So I need 2 levels of reporting: one one syntax errors which I am currently doing by listening to window.addEventListener("error", function (event) {
and trying to report that to the screen.
And second, it would be lack of support of for example web-animations or core-js functions (like array from I believe).
IF that would be caught by the bootstrap Catch clause, that would be great, but I am not sure of that.
from angular.
@mattiLeBlanc, as @JoostK mentioned, these errors are beyond Angular's control because they prevent the script from running altogether. The issue may depend on whether Array.from
is used in a local or global scope.
That said, it appears you are using Angular on browsers that aren't officially supported. You can check the list of supported browsers here: https://angular.dev/reference/versions#browser-support.
from angular.
@alan-agius4 The problem I am facing is that our customers, facilities, use it on devices beyond our control.
For example one device was working on Angular 17 last week but it stopped working on Angular 18. There could be many reasons for that, but all I get from them is that they now see a white screen.
So I am trying to find ways to collect error information.
I am very much aware of Angular's browser support but I I think Angular is pretty much relying on running on modern devices nowadays
But I have to support dodgy TV OS Browsers and there are so many flavours, it is hard to track down.
But anyway, I understand it is not part of Angular's scope or responsibility. However, if Angular is relying on modern browsers, it would be great it there is some tooling around to help developers debug why this current version of the Angular app is not running.
The catch
of the bootstrap function may be helpful, that is if something is breaking within Angular, like perhaps web-animations
not being supported on that device.
But if it is things like null coalescing operator not being supported in the JS dist files, that is harder to catch. But I can try a higher level error listner on the window object to catch those, perhaps.
from angular.
Related Issues (20)
- Support VSCode intellisense for `@Attribute` / `HostAttributeToken` usage. HOT 5
- Page not found HOT 1
- ChangeDetection is not triggered after http put when using provideExperimentalZonelessChangeDetection on Angular 18 HOT 7
- ng update does not migrate the asset folder to the new public folder HOT 3
- @else if and signals narrowing HOT 1
- Standalone component with angular element not working with prod build HOT 1
- Combination of redirecting under a primary route and route guarding a sibling route under a named outlet causes NG04013
- ESBuild (build-angular:application) with ng build --base-href not working as expected HOT 1
- `TestBed.overrideProviders` does not override providers of imported standalone directives HOT 3
- App crash when using ngFor with mapped data and a routerLinkActive directive inside the loop. HOT 2
- FetchBackend expects case sensitive 'Content-Type' HOT 5
- Docs have not the right URL for the image. HOT 1
- Change Behavior of destroyAfterEach or Add Support for destroyBeforeEach Option in TestBed Configuration HOT 2
- Documentation on Content Projection HOT 1
- useValue and useFactory providers throws error when value.constructor is null HOT 1
- Broken link to bootstrapApplication API docs
- 'Must never be called in production mode' HOT 7
- Allow transform functions into input signals HOT 1
- Internal repo tooling: use ESLint instead of the deprecated TSLint HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular.