Hi everyone,

I would like to initiate a discussion on FLIP-368, which focuses on
reorganizing the exceptions thrown in state interfaces [1].

Currently, we have identified several problems with the exceptions
thrown by state-related interfaces:
  1. The exception types thrown by each interface are inconsistent.
While most of the interfaces claim to throw `Exception`, the
interfaces of `ValueState` throw `IOException`. Additionally, the
`State#clear()` never throws an exception. This can be confusing for
users.
  2. The use of `Exception` or `IOException` as the thrown exception
type is too generic and lacks specificity.
  3. Users may not be able to handle these exceptions. In cases where
an exception occurs while accessing state, the job should fail. This
aligns more with the characteristic of *unchecked exceptions* instead
of checked exceptions.

To address these issues, we borrow the idea of throwing unchecked
exceptions in Java Collection API and propose the following changes in
state-related exceptions:
  1. Introduction of specific unchecked exception types for different
reasons, providing users with more precise information about the cause
of the exception.
  2. Removal of all checked exceptions from interface signatures and
instead, throwing newly introduced unchecked exceptions in the
implementations.

Please share your thoughts and suggestions regarding the proposed
changes. Thank you for your attention and support.


Best,
Zakelly

[1] FLIP-368: Reorganize the exceptions thrown in state interfaces,
https://cwiki.apache.org/confluence/x/eZ2zDw

Reply via email to