{"record":{"id":"710485850a2a7969","repo":"SnapDrop/snapdrop","slug":"error","errorCode":null,"errorMessage":"Error","messagePattern":"Error","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/scripts/ui.js","lineNumber":415,"sourceCode":"\n    constructor() {\n        // Check if the browser supports notifications\n        if (!('Notification' in window)) return;\n\n        // Check whether notification permissions have already been granted\n        if (Notification.permission !== 'granted') {\n            this.$button = $('notification');\n            this.$button.removeAttribute('hidden');\n            this.$button.addEventListener('click', e => this._requestPermission());\n        }\n        Events.on('text-received', e => this._messageNotification(e.detail.text));\n        Events.on('file-received', e => this._downloadNotification(e.detail.name));\n    }\n\n    _requestPermission() {\n        Notification.requestPermission(permission => {\n            if (permission !== 'granted') {\n                Events.fire('notify-user', Notifications.PERMISSION_ERROR || 'Error');\n                return;\n            }\n            this._notify('Even more snappy sharing!');\n            this.$button.setAttribute('hidden', 1);\n        });\n    }\n\n    _notify(message, body) {\n        const config = {\n            body: body,\n            icon: '/images/logo_transparent_128x128.png',\n        }\n        let notification;\n        try {\n            notification = new Notification(message, config);\n        } catch (e) {\n            // Android doesn't support \"new Notification\" if service worker is installed\n            if (!serviceWorker || !serviceWorker.showNotification) return;","sourceCodeStart":397,"sourceCodeEnd":433,"githubUrl":"https://github.com/SnapDrop/snapdrop/blob/b8b78cc22a672fd7c442f5a4866a8d9b0c05362e/client/scripts/ui.js#L397-L433","documentation":"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.","triggerScenarios":"Thrown at client/scripts/ui.js:415 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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'"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b8b78cc22a672fd7c442f5a4866a8d9b0c05362e","analyzedAt":"2026-09-02T16:11:56.727Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}