openfga / openfga/java-sdk

Reconsider using checked exceptions

Open
#361 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
54
Forks
26
Avg merge
2d 7h
Merged PRs (30d)
9

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the SDK's checked exception types, including FgaInvalidParameterException, and the operations that report missing or invalid store IDs. The issue does not identify files or tests; done would require a decided scope for which exceptions change and consistent API behavior across the affected cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
authorization
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.