-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Throw checked exceptions from side effects (#132)
- Loading branch information
1 parent
26105f1
commit 79461b9
Showing
4 changed files
with
30 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/ThrowingRunnable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package dev.restate.sdk.blocking; | ||
|
||
/** Like {@link Runnable} but can throw checked exceptions. */ | ||
@FunctionalInterface | ||
public interface ThrowingRunnable { | ||
|
||
/** Run, potentially throwing an exception. */ | ||
void run() throws Throwable; | ||
} |
15 changes: 15 additions & 0 deletions
15
sdk-java-blocking/src/main/java/dev/restate/sdk/blocking/ThrowingSupplier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package dev.restate.sdk.blocking; | ||
|
||
import java.util.function.Supplier; | ||
|
||
/** Like {@link Supplier} but can throw checked exceptions. */ | ||
@FunctionalInterface | ||
public interface ThrowingSupplier<T> { | ||
|
||
/** | ||
* Get a result, potentially throwing an exception. | ||
* | ||
* @return a result | ||
*/ | ||
T get() throws Throwable; | ||
} |