Skip to content

Scheduling infrastructure for absolutely everyone.

refactor: error message for notification subscription failure (#23304)

Bandhan Majumder4fb3639f7153
diff --git a/packages/features/notifications/WebPushContext.tsx b/packages/features/notifications/WebPushContext.tsx
index f2715042901..292ef2ad28c 100644
--- a/packages/features/notifications/WebPushContext.tsx
+++ b/packages/features/notifications/WebPushContext.tsx
@@ -71,7 +71,15 @@ export function WebPushProvider({ children }: ProviderProps) {
}
} catch (error) {
console.error("Failed to subscribe:", error);
- showToast("Failed to enable notifications", "error");
+ if (
+ error instanceof DOMException &&
+ error.name === "InvalidAccessError" &&
+ error.message.includes("applicationServerKey")
+ ) {
+ showToast("Please enable Google services for push messaging and try again", "error");
+ } else {
+ showToast("Failed to enable notifications", "error");
+ }
} finally {
setIsLoading(false);
}