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 var updatedGithubContent: String = githubFileContent.decryptedContent
// TASK -> Update Analytics Image in Readme // TASK -> Update Analytics Image in Readme
updatedGithubContent = updateAnalyticsImage( try {
updatedGithubContent, updatedGithubContent = updateAnalyticsImage(
secrets updatedGithubContent,
) secrets
)
} catch (e:Exception) {
debug("Analytics Image Updation Failed",e.message.toString())
}
// TASK -> Update Total Downloads Card // TASK -> Update Total Downloads Card
updatedGithubContent = updateDownloadCards( try {
updatedGithubContent, updatedGithubContent = updateDownloadCards(
secrets.copy(tagName = "DCI") updatedGithubContent,
) secrets.copy(tagName = "DCI")
)
} catch (e:Exception) {
debug("Download Card Updation Failed",e.message.toString())
}
// Write New Updated README.md // Write New Updated README.md
GithubService.updateGithubFileContent( GithubService.updateGithubFileContent(

View File

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