Skip to content

Commit 4fb3639

Browse files
refactor: error message for notification subscription failure (calcom#23304)
* improve: error message for notification subscription failure * suggestions * Update WebPushContext.tsx --------- Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
1 parent d44a41c commit 4fb3639

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

packages/features/notifications/WebPushContext.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,15 @@ export function WebPushProvider({ children }: ProviderProps) {
7171
}
7272
} catch (error) {
7373
console.error("Failed to subscribe:", error);
74-
showToast("Failed to enable notifications", "error");
74+
if (
75+
error instanceof DOMException &&
76+
error.name === "InvalidAccessError" &&
77+
error.message.includes("applicationServerKey")
78+
) {
79+
showToast("Please enable Google services for push messaging and try again", "error");
80+
} else {
81+
showToast("Failed to enable notifications", "error");
82+
}
7583
} finally {
7684
setIsLoading(false);
7785
}

0 commit comments

Comments
 (0)