Question

Yesterday, I went to http://try.discourse.org, the new project developed by the Stack Overflow team. This project uses the EmberJs javascript Framework for requesting the content. And unfortunately my browser (Safari) sees the following error in the code:

TypeError: 'undefined' is not an object (evaluating 'PreloadStore.get("siteSettings").top_menu')

The consequence of this error is that no content is displayed; I have a blank page. The javascript error logically prevents the content from displaying.

My question is:

If javascript is disabled in my browser, I can see the content of Dicourse because of the <noscript> </noscript> tag in html.

But if I have javascript enabled and it encounters an error, I can see nothing.

So, in a web app development, is there a way to display the no script content or alternative content if the javascript app encounters an error?

Was it helpful?

Solution

You can handle all errors that take place in AngularJS world by overwriting the $exceptionHandler service in your application : http://docs.angularjs.org/api/ng.$exceptionHandler

AngularJS prevents exceptions taking place in angular world to crash the browser :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top