SnapDrop/snapdrop · error
Error
Error message
Error
What it means
A generic console error emitted from _requestPermission when obtaining notification permission fails: Notification.requestPermission() rejected or resolved to 'denied'. The message is an uninformative sentinel ('Error') — the faulty input is the browser's permission result for the Notifications API.
Source
Thrown at client/scripts/ui.js:415
constructor() {
// Check if the browser supports notifications
if (!('Notification' in window)) return;
// Check whether notification permissions have already been granted
if (Notification.permission !== 'granted') {
this.$button = $('notification');
this.$button.removeAttribute('hidden');
this.$button.addEventListener('click', e => this._requestPermission());
}
Events.on('text-received', e => this._messageNotification(e.detail.text));
Events.on('file-received', e => this._downloadNotification(e.detail.name));
}
_requestPermission() {
Notification.requestPermission(permission => {
if (permission !== 'granted') {
Events.fire('notify-user', Notifications.PERMISSION_ERROR || 'Error');
return;
}
this._notify('Even more snappy sharing!');
this.$button.setAttribute('hidden', 1);
});
}
_notify(message, body) {
const config = {
body: body,
icon: '/images/logo_transparent_128x128.png',
}
let notification;
try {
notification = new Notification(message, config);
} catch (e) {
// Android doesn't support "new Notification" if service worker is installed
if (!serviceWorker || !serviceWorker.showNotification) return;View on GitHub (pinned to b8b78cc22a)
Solutions
- Wrap Notification.requestPermission() in try/catch and inspect err.name for the real cause
- Handle result 'denied' separately from a rejected promise
- Show the stored Notifications.PERMISSION_ERROR text explaining how to unblock via the lock icon / Page Info
- Only reveal the notification button when Notification.permission is not already 'denied'
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at client/scripts/ui.js:415 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of SnapDrop/snapdrop@b8b78cc22a (2026-09-02).
Data as JSON: /api/errors/710485850a2a7969.
Report an issue: GitHub.