Giter VIP home page Giter VIP logo

Comments (7)

JeanMeche avatar JeanMeche commented on July 3, 2024

You should be able to catch errors on bootstraping with :

bootstrapApplication(AppComponen).catch((error) => alert(error));

from angular.

mattiLeBlanc avatar mattiLeBlanc commented on July 3, 2024

@JeanMeche Would that included errors like when web-animations are not supported or some Core JS Functions are missing?

from angular.

JeanMeche avatar JeanMeche commented on July 3, 2024

Anything that throws an error on bootstrap.
Else you'll probably want to attach an ErrorHandler : https://angular.dev/api/core/ErrorHandler

from angular.

JoostK avatar JoostK commented on July 3, 2024

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.

mattiLeBlanc avatar mattiLeBlanc commented on July 3, 2024

@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.

alan-agius4 avatar alan-agius4 commented on July 3, 2024

@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.

mattiLeBlanc avatar mattiLeBlanc commented on July 3, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.