Skip to content

Conflicting error extension function can lead to Unexpected Runtime Exceptions #2887

Description

@itsusmon

Is your feature request related to a problem? Please describe.

The name of the extension function error for the ImageRequest.Builder class is confusing. I'm using Coil in a view-based Android project. I was using the ImageView.load function inside of a fragment and would use error(@DrawableRes drawableResId: Int). But since it's an extension function, it requires importing. When I was writing code, the IDEA automatically imported the error(message: Any) function from Kotlin stdlib, which throws IllegalStateException and causes a runtime exception.

Describe the solution you'd like

Could the error function be renamed to onError? Or the library should include a lint check that warns the user when there is an error(message: Any) function (from stdlib) usage in the context of ImageRequest.Builder class.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedIssues that are up for grabs + are good candidates for community PRs

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions