mirror of
https://github.com/mas-cli/mas
synced 2024-11-26 05:20:18 +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 {
|
func run(searcher: AppStoreSearcher) throws {
|
||||||
guard let result = try searcher.lookup(appID: appID).wait() else {
|
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 {
|
guard let url = URL(string: result.trackViewUrl) else {
|
||||||
|
|
|
@ -28,7 +28,7 @@ extension MAS {
|
||||||
func run(searcher: AppStoreSearcher) throws {
|
func run(searcher: AppStoreSearcher) throws {
|
||||||
do {
|
do {
|
||||||
guard let result = try searcher.lookup(appID: appID).wait() else {
|
guard let result = try searcher.lookup(appID: appID).wait() else {
|
||||||
throw MASError.noSearchResultsFound
|
throw MASError.unknownAppID(appID)
|
||||||
}
|
}
|
||||||
|
|
||||||
print(AppInfoFormatter.format(app: result))
|
print(AppInfoFormatter.format(app: result))
|
||||||
|
|
|
@ -27,6 +27,9 @@ enum MASError: Error, Equatable {
|
||||||
|
|
||||||
case searchFailed
|
case searchFailed
|
||||||
case noSearchResultsFound
|
case noSearchResultsFound
|
||||||
|
|
||||||
|
case unknownAppID(AppID)
|
||||||
|
|
||||||
case noVendorWebsite
|
case noVendorWebsite
|
||||||
|
|
||||||
case notInstalled(appID: AppID)
|
case notInstalled(appID: AppID)
|
||||||
|
@ -83,6 +86,8 @@ extension MASError: CustomStringConvertible {
|
||||||
return "Search failed"
|
return "Search failed"
|
||||||
case .noSearchResultsFound:
|
case .noSearchResultsFound:
|
||||||
return "No results found"
|
return "No results found"
|
||||||
|
case .unknownAppID(let appID):
|
||||||
|
return "Unknown app ID \(appID)"
|
||||||
case .noVendorWebsite:
|
case .noVendorWebsite:
|
||||||
return "App does not have a vendor website"
|
return "App does not have a vendor website"
|
||||||
case .notInstalled(let appID):
|
case .notInstalled(let appID):
|
||||||
|
|
Loading…
Reference in a new issue