diff --git a/src/web/app/common/mios.ts b/src/web/app/common/mios.ts index dfc83c18c..6ee42ea8a 100644 --- a/src/web/app/common/mios.ts +++ b/src/web/app/common/mios.ts @@ -257,11 +257,17 @@ export default class MiOS extends EventEmitter { auth: encode(subscription.getKey('auth')), publickey: encode(subscription.getKey('p256dh')) }); - }).then(() => { - this.logInfo('[sw] Server Stored Subscription.'); - }).catch(async (err) => { + }) + // When subscribe failed + .catch(async (err: Error) => { this.logError('[sw] Subscribe Error:', err); + // 通知が許可されていなかったとき + if (err.name == 'NotAllowedError') { + this.logError('[sw] Subscribe failed due to notification not allowed'); + return; + } + // 違うapplicationServerKey (または gcm_sender_id)のサブスクリプションが // 既に存在していることが原因でエラーになった可能性があるので、 // そのサブスクリプションを解除しておく