mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-08 04:20:07 +02:00
👌 Handle errors
This commit is contained in:
@ -56,7 +56,10 @@ class InterApp {
|
|||||||
if PhpEnv.shared.availablePhpVersions.contains(version) {
|
if PhpEnv.shared.availablePhpVersions.contains(version) {
|
||||||
MainMenu.shared.switchToPhpVersion(version)
|
MainMenu.shared.switchToPhpVersion(version)
|
||||||
} else {
|
} else {
|
||||||
Alert.notify(message: "Unsupported version", info: "PHP Monitor can't switch to PHP \(version), as it may not be installed or available.")
|
BetterAlert().withInformation(
|
||||||
|
title: "Unsupported version",
|
||||||
|
subtitle: "PHP Monitor can't switch to PHP \(version), as it may not be installed or available."
|
||||||
|
).withPrimary(text: "OK").show()
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
]}
|
]}
|
||||||
|
@ -85,7 +85,10 @@ class BetterAlert {
|
|||||||
If you wish to simply show the alert and disregard the outcome, use `show`.
|
If you wish to simply show the alert and disregard the outcome, use `show`.
|
||||||
*/
|
*/
|
||||||
public func runModal() -> NSApplication.ModalResponse {
|
public func runModal() -> NSApplication.ModalResponse {
|
||||||
#warning("You should be alerted if this is not being called on the main thread.")
|
if !Thread.isMainThread {
|
||||||
|
fatalError("You should always present alerts on the main thread!")
|
||||||
|
}
|
||||||
|
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
windowController.window?.makeKeyAndOrderFront(nil)
|
windowController.window?.makeKeyAndOrderFront(nil)
|
||||||
return NSApplication.shared.runModal(for: windowController.window!)
|
return NSApplication.shared.runModal(for: windowController.window!)
|
||||||
|
Reference in New Issue
Block a user