angular: bug(error-logger): `console.error` may be undefined

I’m submitting a … (check one with “x”)

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior On a Galaxy S4 device (running Android 5.0.1), in a web application using ionic, sometimes, it would throw the following error:

ERROR Error: Uncaught (in promise): TypeError: Cannot read property ‘apply’ of undefined(…)defaultErrorLogger

This error originates from: https://github.com/angular/angular/blob/4.0.x/packages/core/src/errors.ts#L36 (Source map points me there)

Which is very interesting, as why would the console.error not exist? who knows.

Expected behavior Some kind of a try/catch in the defaultErrorLogger method, or some check if console.log exists.

Minimal reproduction of the problem with instructions I don’t know, it happens sometimes, on a device.

What is the motivation / use case for changing the behavior? The error logger should not throw errors…

Please tell us about your environment:

    Angular version: 4.0.0
    Cordova CLI: 6.5.0
    Ionic CLI Version: 3.0.0-beta.5
    ios-deploy version: Not installed
    ios-sim version: Not installed
    OS: Windows 10
    Node Version: v6.9.1
    Xcode version: Not installed

Device for errors:

Device: Galaxy S4
OS: Android 5.0.1
  • Angular version: 4.0.0

  • Browser: Android 5.0.1 Web Browser

  • Language: TypeScript 2.2.1

  • Node (for AoT issues): node --version = v6.9.1

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 16 (4 by maintainers)

Most upvoted comments

any news? How can I temporary resolve this issue?