Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Account for missing JSON fields in search results #299

Merged
merged 15 commits into from
Sep 7, 2020
Merged

Conversation

phatblat
Copy link
Member

@phatblat phatblat commented Sep 6, 2020

Fixes an issue where some search terms cause mas to crash with the message "Error: Unable to parse response JSON". This is due to some search results not containing entries for the following keys:

  • fileSizeBytes
  • formattedPrice
  • price (normally present, but "Free" when no cost)

Fixes #284

@phatblat phatblat added this to the Unreleased milestone Sep 6, 2020
MasKitTests/Models/SearchResultSpec.swift Outdated Show resolved Hide resolved
MasKitTests/Models/SearchResultListSpec.swift Outdated Show resolved Hide resolved
MasKitTests/Models/SearchResultListSpec.swift Outdated Show resolved Hide resolved
do {
lookup = try storeSearch.lookup(app: appId)
} catch {
let maserror = error as! MASError

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Force Cast Violation: Force casts should be avoided. (force_cast)

expect(searchList.resultCount) == 39
expect(searchList.results.count) == 39
} catch {
let maserror = error as! MASError

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Force Cast Violation: Force casts should be avoided. (force_cast)

init(from fileName: String) {
let fileURL = Bundle.url(for: fileName)!
print("fileURL: \(fileURL)")
try! self.init(contentsOf: fileURL, options: .mappedIfSafe)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Force Try Violation: Force tries should be avoided. (force_try)

@masclibot
Copy link

masclibot commented Sep 6, 2020

1 Warning
⚠️ 😵 Big PR

Generated by 🚫 Danger

@phatblat phatblat changed the base branch from master to v1.7 September 7, 2020 04:26
@phatblat phatblat marked this pull request as ready for review September 7, 2020 04:31
@phatblat phatblat merged commit 4ad7b8d into v1.7 Sep 7, 2020
@phatblat phatblat deleted the search-json branch September 7, 2020 04:32
@phatblat phatblat mentioned this pull request Sep 7, 2020
@phatblat phatblat modified the milestones: Unreleased, 1.7.1 Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 [BUG] mas search things fails with "Error: Unable to parse response JSON"
3 participants