Skip to content

Service Worker registration does not use ErrorHandler #39913

@chrisguttandin

Description

@chrisguttandin

🐞 bug report

Affected Package

The issue is caused by package @angular/service-worker

Is this a regression?

No, I don't think so,

Description

The Service Worker registration logs an error in the console when the it fails. I think that's confusing and it would be better to use the ErrorHandler which other parts of Angular use. That way Angular users could handle the error themselves.

🔬 Minimal Reproduction

As far as I know there is not really an easy way to reproduce this besides deploying a broken app. I hope it's okay to point to the source instead.

navigator.serviceWorker.register(script, {scope: options.scope})
.catch(err => console.error('Service worker registration failed with:', err))));

This is where the Service Worker gets registered and possible errors get logged to the console directly.

🔥 Exception or Error





🌍 Your Environment

Angular Version:


Angular CLI: 11.0.2
Node: 12.20.0
OS: darwin x64

Angular: 11.0.2
... animations, cli, common, compiler, compiler-cli, core
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router, service-worker
Ivy Workspace: 

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1100.2
@angular-devkit/build-angular   0.1100.2
@angular-devkit/core            11.0.2
@angular-devkit/schematics      11.0.2
@schematics/angular             11.0.2
@schematics/update              0.1100.2
rxjs                            6.6.3
typescript                      4.0.5

Anything else relevant?

I would be happy to create a PR for fixing this. Please let me know if I should do so.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: service-workerIssues related to the @angular/service-worker packagetype: bug/fix

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy