Skip to content

Reconsider using checked exceptions #361

Description

@rellis-of-rhindleton

The SDK throws checked exceptions in several cases, e.g. when the store ID is missing or invalid. I request these be unchecked instead.

Checked exceptions were a Java feature intended for errors that you could recover from on the fly -- while the application is running and the scope has not elapsed. That describes a limited set of error conditions. At least some exceptions thrown by this SDK (e.g. FgaInvalidParameterException) don't fit this description. They are only going to be fixable by making code and/or configuration changes. This is especially true if the operation is being performed in something that has a limited scope, such as an API with request scoping.

Using checked exceptions in most cases provides no benefit, and forces the developer to wrap them in unchecked RuntimeExceptions, which adds noise to both the code and the logging/monitoring output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Intake

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions