mirror of
https://github.com/mas-cli/mas
synced 2024-11-22 03:23:08 +00:00
Add & use MASError.unknownAppID(AppID)
.
Partial #533 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
This commit is contained in:
parent
d59249ac33
commit
0a05cd438f
3 changed files with 7 additions and 2 deletions
|
@ -27,7 +27,7 @@ extension MAS {
|
|||
|
||||
func run(searcher: AppStoreSearcher) throws {
|
||||
guard let result = try searcher.lookup(appID: appID).wait() else {
|
||||
throw MASError.noSearchResultsFound
|
||||
throw MASError.unknownAppID(appID)
|
||||
}
|
||||
|
||||
guard let url = URL(string: result.trackViewUrl) else {
|
||||
|
|
|
@ -28,7 +28,7 @@ extension MAS {
|
|||
func run(searcher: AppStoreSearcher) throws {
|
||||
do {
|
||||
guard let result = try searcher.lookup(appID: appID).wait() else {
|
||||
throw MASError.noSearchResultsFound
|
||||
throw MASError.unknownAppID(appID)
|
||||
}
|
||||
|
||||
print(AppInfoFormatter.format(app: result))
|
||||
|
|
|
@ -27,6 +27,9 @@ enum MASError: Error, Equatable {
|
|||
|
||||
case searchFailed
|
||||
case noSearchResultsFound
|
||||
|
||||
case unknownAppID(AppID)
|
||||
|
||||
case noVendorWebsite
|
||||
|
||||
case notInstalled(appID: AppID)
|
||||
|
@ -83,6 +86,8 @@ extension MASError: CustomStringConvertible {
|
|||
return "Search failed"
|
||||
case .noSearchResultsFound:
|
||||
return "No results found"
|
||||
case .unknownAppID(let appID):
|
||||
return "Unknown app ID \(appID)"
|
||||
case .noVendorWebsite:
|
||||
return "App does not have a vendor website"
|
||||
case .notInstalled(let appID):
|
||||
|
|
Loading…
Reference in a new issue