Skip to content

Commit dea6bae

Browse files
Don't try to handle Error (#376)
1 parent b28f7da commit dea6bae

File tree

4 files changed

+0
-14
lines changed

4 files changed

+0
-14
lines changed

sdk-api-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/ContextImpl.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,6 @@ internal class ContextImpl internal constructor(private val syscalls: Syscalls)
173173
actionReturnValue = block()
174174
} catch (e: TerminalException) {
175175
actionFailure = e
176-
} catch (e: Error) {
177-
throw e
178176
} catch (t: Throwable) {
179177
syscalls.fail(t)
180178
throw CancellationException("Side effect failure", t)

sdk-api-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/HandlerRunner.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ internal constructor(
6363
val req: REQ
6464
try {
6565
req = handlerSpecification.requestSerde.deserialize(syscalls.request().bodyBuffer())
66-
} catch (e: Error) {
67-
throw e
6866
} catch (e: Throwable) {
6967
LOG.warn("Error when deserializing input", e)
7068
throw TerminalException(
@@ -77,8 +75,6 @@ internal constructor(
7775
// Serialize output
7876
try {
7977
serializedResult = handlerSpecification.responseSerde.serializeToByteBuffer(res)
80-
} catch (e: Error) {
81-
throw e
8278
} catch (e: Throwable) {
8379
LOG.warn("Error when serializing input", e)
8480
throw TerminalException(

sdk-api/src/main/java/dev/restate/sdk/ContextImpl.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,6 @@ public void onCancel(@Nullable Throwable t) {
168168
res = action.get();
169169
} catch (TerminalException e) {
170170
failure = e;
171-
} catch (Error e) {
172-
throw e;
173171
} catch (Throwable e) {
174172
syscalls.fail(e);
175173
AbortedExecutionException.sneakyThrow();

sdk-api/src/main/java/dev/restate/sdk/HandlerRunner.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ public void run(
6969
try {
7070
req =
7171
handlerSpecification.getRequestSerde().deserialize(syscalls.request().bodyBuffer());
72-
} catch (Error e) {
73-
throw e;
7472
} catch (Throwable e) {
7573
LOG.warn("Cannot deserialize input", e);
7674
callback.onCancel(
@@ -84,8 +82,6 @@ public void run(
8482
RES res;
8583
try {
8684
res = this.runner.apply(ctx, req);
87-
} catch (Error e) {
88-
throw e;
8985
} catch (Throwable e) {
9086
callback.onCancel(e);
9187
return;
@@ -95,8 +91,6 @@ public void run(
9591
ByteBuffer serializedResult;
9692
try {
9793
serializedResult = handlerSpecification.getResponseSerde().serializeToByteBuffer(res);
98-
} catch (Error e) {
99-
throw e;
10094
} catch (Throwable e) {
10195
LOG.warn("Cannot serialize output", e);
10296
callback.onCancel(

0 commit comments

Comments
 (0)