Skip to content

Conversation

@dustdfg
Copy link
Contributor

@dustdfg dustdfg commented Jan 9, 2026

What is it?

  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

  • Replace Illegal{State,Argument} exceptions with more idiomatic kotlin code

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR. You can find more info and a video demonstration on this wiki page.

Due diligence

@github-actions github-actions bot added the size/small PRs with less than 50 changed lines label Jan 9, 2026
Comment on lines 95 to 109
else -> throw IllegalArgumentException("Unknown position for ViewPager2")
else -> error("Unknown position for ViewPager2")
}
}

override fun getItemCount(): Int {
// Show 2 total pages.
return totalCount
}

fun getPageTitle(position: Int): Int {
return when (position) {
posAbout -> R.string.tab_about
posLicense -> R.string.tab_licenses
else -> throw IllegalArgumentException("Unknown position for ViewPager2")
else -> error("Unknown position for ViewPager2")
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just formally it replaces IllegalArgumentException with IllegalStateException but the errors by itself are both Argument and State errors. In this PR you can also see that other places like these were using State exception so I think that just using error is appropriate enough

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/small PRs with less than 50 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant