Skip to content

Commit 132504f

Browse files
committed
Better error handler when fetching the settings.
1 parent 68dbcb2 commit 132504f

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

Application/SCSHWrapper.swift

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,25 @@ public class SCSHWrapper: NSObject {
6969
private override init() {
7070
super.init()
7171

72-
self.reloadSettings(handler: nil)
72+
guard let _ = SCSHWrapper.service else {
73+
let alert = NSAlert()
74+
alert.messageText = "Unable to connect to the XPC Service!"
75+
alert.informativeText = "Try to restart the system and/or reinstall the app."
76+
alert.alertStyle = .critical
77+
78+
return
79+
}
80+
81+
self.reloadSettings { (_, success) in
82+
if !success {
83+
let alert = NSAlert()
84+
alert.messageText = "Unable to fetch settings!"
85+
alert.informativeText = "Settings are reset to the factory default."
86+
alert.alertStyle = .critical
87+
88+
self.initSettings(from: [:])
89+
}
90+
}
7391

7492
NotificationCenter.default.addObserver(self, selector: #selector(afterThemeDeleted(_:)), name: .CustomThemeRemoved, object: nil)
7593
}

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
# Changelog
1+
Changelog
22
=======
33

4+
### 2.0.3
5+
Bugfix:
6+
- Better error handler when fetching the settings.
7+
48
### 2.0.2
59
Bugfix:
610
- Word wrap settings not saved.

0 commit comments

Comments
 (0)