Maintenance Try/Catch

This commit is contained in:
shabinder 2021-06-06 00:32:49 +05:30
parent 6dcbfd30b3
commit ffbc3a5e0f
2 changed files with 18 additions and 9 deletions

View File

@ -20,16 +20,24 @@ fun main(args: Array<String>) {
var updatedGithubContent: String = githubFileContent.decryptedContent
// TASK -> Update Analytics Image in Readme
updatedGithubContent = updateAnalyticsImage(
updatedGithubContent,
secrets
)
try {
updatedGithubContent = updateAnalyticsImage(
updatedGithubContent,
secrets
)
} catch (e:Exception) {
debug("Analytics Image Updation Failed",e.message.toString())
}
// TASK -> Update Total Downloads Card
updatedGithubContent = updateDownloadCards(
updatedGithubContent,
secrets.copy(tagName = "DCI")
)
try {
updatedGithubContent = updateDownloadCards(
updatedGithubContent,
secrets.copy(tagName = "DCI")
)
} catch (e:Exception) {
debug("Download Card Updation Failed",e.message.toString())
}
// Write New Updated README.md
GithubService.updateGithubFileContent(

View File

@ -54,12 +54,13 @@ internal suspend fun getAnalyticsImage(): String {
}
}
contentLength = req.headers["Content-Length"]?.toLong() ?: 0
debug(contentLength.toString())
debug("Content Length for Analytics Image",contentLength.toString())
if(retryCount-- == 0){
// FAIL Gracefully
throw(RETRY_LIMIT_EXHAUSTED())
}
}while (contentLength<1_20_000)
return analyticsImage
}