Add & use MASError.unknownAppID(AppID).

Partial #533

Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
This commit is contained in:
Ross Goldberg 2024-10-28 14:38:06 -04:00
parent d59249ac33
commit 0a05cd438f
No known key found for this signature in database
3 changed files with 7 additions and 2 deletions

View file

@ -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 {

View file

@ -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))

View file

@ -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):