Show text for json parse errors from github search

This commit is contained in:
yairm210
2024-07-28 14:07:12 +03:00
parent e42e3273fe
commit 7c9aab5e63

View File

@ -212,7 +212,12 @@ object Github {
retries++ // An extra retry so the 403 is ignored in the retry count
}
} ?: continue
return json().fromJson(GithubAPI.RepoSearch::class.java, inputStream.bufferedReader().readText())
val text = inputStream.bufferedReader().readText()
try {
return json().fromJson(GithubAPI.RepoSearch::class.java, text)
} catch (_: Throwable) {
throw Exception("Failed to parse Github response as json - $text")
}
}
return null
}