Skip to content

Commit ebfcd34

Browse files
committed
Fix trigger command to correctly throw error
1 parent d8867ba commit ebfcd34

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

Core/Sources/Environment/Environment.swift

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ public enum Environment {
163163
Logger.service
164164
.error("Trigger command \(name) failed: \(error.localizedDescription)")
165165
throw error
166+
} else {
167+
return
166168
}
167169
}
168170
} else if let commandMenu = app.menuBar?.child(title: bundleName),
@@ -173,17 +175,18 @@ public enum Environment {
173175
Logger.service
174176
.error("Trigger command \(name) failed: \(error.localizedDescription)")
175177
throw error
178+
} else {
179+
return
176180
}
177-
} else {
178-
struct CantRunCommand: Error, LocalizedError {
179-
let name: String
180-
var errorDescription: String? {
181-
"Can't run command \(name)."
182-
}
181+
}
182+
struct CantRunCommand: Error, LocalizedError {
183+
let name: String
184+
var errorDescription: String? {
185+
"Can't run command \(name)."
183186
}
184-
185-
throw CantRunCommand(name: name)
186187
}
188+
189+
throw CantRunCommand(name: name)
187190
} else {
188191
/// check if menu is open, if not, click the menu item.
189192
let appleScript = """

0 commit comments

Comments
 (0)