Skip to content

Commit

Permalink
[FIXED] Added logic to skip user if it's a invalid user
Browse files Browse the repository at this point in the history
Allowing stats to continue generation
  • Loading branch information
hossain-khan committed Dec 22, 2024
1 parent 062c3dc commit 0f883c1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import dev.hossain.githubstats.logging.Log
import dev.hossain.githubstats.model.Issue
import dev.hossain.githubstats.model.IssueSearchResult
import dev.hossain.githubstats.service.GithubApiService.Companion.DEFAULT_PAGE_SIZE
import dev.hossain.githubstats.util.ErrorInfo
import dev.hossain.githubstats.util.ErrorProcessor
import kotlinx.coroutines.delay
import kotlin.math.ceil
Expand Down Expand Up @@ -33,8 +34,14 @@ class IssueSearchPagerService constructor(
size = pageSize,
)
} catch (exception: Exception) {
val errorInfo = errorProcessor.getDetailedError(exception)
throw errorInfo.exception
val errorInfo: ErrorInfo = errorProcessor.getDetailedError(exception)

if(errorInfo.isUserNotFound()) {
Log.w("❌ User not found. Skipping the PR list search for the user.\n")
return emptyList()
} else {
throw errorInfo.exception
}
}

val totalItemCount: Int = issueSearchResult.total_count
Expand Down
6 changes: 5 additions & 1 deletion src/main/kotlin/dev/hossain/githubstats/util/ErrorInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ data class ErrorInfo(
val exception: Exception,
val debugGuideMessage: String = "",
val githubError: GithubError? = null,
)
) {
fun isUserNotFound(): Boolean {
return ErrorProcessor.isUserMissingError(githubError)
}
}

/**
* Error threshold information.
Expand Down

0 comments on commit 0f883c1

Please sign in to comment.