A clock that counts down the seconds you have left to live
Note: Binary files aren't shown on the web site. To see all files, please download the extension zipfile.
Shall I remove all the try-catch wrappers, or just which you have mentioned? There is one more in the _save_settings() which is on line number 140 to 162.
I have removed the wrappers while still keeping them for error handling where they are required. You can verify here as well. _loadSettings() { let file = Gio.File.new_for_path(this._settingsFile); // Asynchronously load settings to avoid blocking the GNOME Shell main loop file.load_contents_async(null, (source, res) => { try { let [success, contents] = source.load_contents_finish(res); if (success && contents) { let settings = JSON.parse(new TextDecoder().decode(contents)); if (settings.targetDate) { this._targetDate = new Date(settings.targetDate); } if (settings.unit) { this._currentUnit = settings.unit; } if (settings.showUnitText !== undefined) { this._showUnitText = settings.showUnitText; } if (settings.showIcon !== undefined) { this._showIcon = settings.showIcon; } if (settings.numberFormat) { this._numberFormat = settings.numberFormat; } } } catch (e) { console.error(`Death Clock: Error loading settings: ${e}`); } finally { // Ensure we have a sensible default target date if (!this._targetDate) { this._targetDate = new Date(); this._targetDate.setFullYear(this._targetDate.getFullYear() + 80); } // Update UI/menu to reflect loaded settings this._updateDateDisplay(); if (this._unitMenuItems) this._updateUnitMenuItems(); if (this._formatMenuItems) this._updateFormatMenuItems(); this._updateDisplay(); } }); } _saveSettings() { let settings = { targetDate: this._targetDate.toISOString(), unit: this._currentUnit, showUnitText: this._showUnitText, showIcon: this._showIcon, numberFormat: this._numberFormat }; let file = Gio.File.new_for_path(this._settingsFile); // Use async replace to avoid blocking GNOME Shell let contents = JSON.stringify(settings); file.replace_contents_async(contents, null, false, Gio.FileCreateFlags.REPLACE_DESTINATION, null, (source, res) => { try { source.replace_contents_finish(res); } catch (e) { console.error(`Death Clock: Error saving settings: ${e}`); } } ); }