Skip to content

Commit

Permalink
fix: register not throwing the error correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
BoussonKarel committed Dec 30, 2022
1 parent 217f49b commit 52defcb
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions addon/services/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,19 @@ export default class ServiceWorker extends EventedService {
}

async register(swFile) {
try {
const swUrl = `${this.config.rootURL}${swFile}`;
this.wb = new Workbox(swUrl);
const swUrl = `${this.config.rootURL}${swFile}`;
this.wb = new Workbox(swUrl);

return this.wb.register().then((registration) => {
return this.wb
.register()
.then((registration) => {
return this._onRegistration(registration);
})
.catch((error) => {
this.trigger('error', error);
this._log('Service Worker registration failed: ', error);
throw error;
});
} catch (error) {
this.trigger('error', error);
this._log('Service Worker registration failed: ', error);

throw error;
}
}

/*
Expand Down

0 comments on commit 52defcb

Please sign in to comment.