angular-cn/aio/src
George Kalpakas e7c770709b fix(docs-infra): correctly handle reported errors (#42883)
Error-handling in AIO happens mainly in two places:
1. For errors happening inside the app we have a custom `ErrorHandler`
   implementation, `ReportingErrorHandler`. `ReportingErrorHandler`
   passes errors to the default `ErrorHandler` (for them to be logged to
   the console) and also forwards them to `window.onerror()`.
2. Errors happening outside the app and errors forwarded by
   `ReportingErrorHandler` are handled by `window.onerror()`, which in
   turn reports them to Google analytics.

Previously, we were making some assumptions (which turned out to be
incorrect based on the info captured in Google analytics - see #28106):
- `ReportingErrorHandler` assumed that the errors passed to its
  `handleError()` method would be either strings or `Error` instances.
  _Apparently, other values (such as `null` or `undefined`) may also be
  passed._
- `window.onerror()` assumed that if an `Error` instance was passed in,
  it would always have a stacktrace (i.e. its `stack` property would be
  defined).
  _This is not necessarily true, although it is not clear (based on the
  logs) whether reported errors of this type are caused by `Error`
  instance with no stacktrace or by non-string error objects which are
  incorrectly treated as `Error` instances.

This commit ensures that all types of error arguments can be handled
correctly, including `Error` instances with no stacktrace and other
types of objects or primitives.

NOTE:
PR #42881 is related as it fixes handling `null` and `undefined`
arguments in the default `ErrorHandler`.

Fixes #28106

PR Close #42883
2021-07-19 17:35:02 -07:00
..
app fix(docs-infra): correctly handle reported errors (#42883) 2021-07-19 17:35:02 -07:00
assets fix(docs-infra): fix display of AngularJS logo on the "Press kit" page in IE11 (#41183) 2021-03-12 13:22:57 -08:00
environments build(docs-infra): align code with new CLI v12 apps (#42259) 2021-06-14 09:54:08 -07:00
extra-files docs: update links to use HTTPS as protocol (#39718) 2020-11-20 12:52:16 -08:00
styles fix(docs-infra): fix margin of social icon on small screens (#42790) 2021-07-09 10:15:27 -07:00
testing refactor(docs-infra): enable tslint rules for the angular.io app (#39307) 2020-12-17 10:02:38 -08:00
404-body.html fix(docs-infra): styling fix on error pages (#42627) 2021-06-28 09:50:24 -07:00
custom-elements-es5-polyfills.js fix(docs-infra): fix angular.io on browsers that support Custom Elements but not ES2015 (#41183) 2021-03-12 13:22:57 -08:00
google385281288605d160.html build(aio): add google webmaster tools verification file 2017-05-26 01:25:58 -07:00
index.html fix(docs-infra): correctly handle reported errors (#42883) 2021-07-19 17:35:02 -07:00
main.ts feat(docs-infra): Convert AIO to use the new Service Worker 5.0.0. (#19795) 2018-08-27 16:30:42 -04:00
noop-worker-basic.js feat(aio): provide noop service worker file 2017-05-26 14:24:41 +01:00
polyfills.ts fix(docs-infra): avoid unnecessarily loading Custom Elements ES5 shim (#41162) 2021-03-11 09:25:32 -08:00
pwa-manifest.json feat(docs-infra): add shortcuts for the angular.io PWA (#40393) 2021-01-15 10:38:39 -08:00
test.ts build(docs-infra): add `assert` polyfill (#41764) 2021-04-28 12:33:20 -07:00