Skip to content

Commit 278aafc

Browse files
committed
Exceptions refactoring.
1 parent 20b8dab commit 278aafc

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/main/java/io/eigr/spawn/api/ActorRef.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public <T extends GeneratedMessageV3> void invokeAsync(String action) throws Spa
203203
* Please see the {@link io.eigr.spawn.api.InvocationOpts} class for more information
204204
* @since 0.0.1
205205
*/
206-
public <T extends GeneratedMessageV3> void invokeAsync(String action, InvocationOpts opts) throws SpawnException {
206+
public <T extends GeneratedMessageV3> void invokeAsync(String action, InvocationOpts opts) throws ActorInvocationException {
207207
InvocationOpts mergedOpts = InvocationOpts.builder()
208208
.async(true)
209209
.delaySeconds(opts.getDelaySeconds())
@@ -223,7 +223,7 @@ public <T extends GeneratedMessageV3> void invokeAsync(String action, Invocation
223223
* @param value the action argument object.
224224
* @since 0.0.1
225225
*/
226-
public <T extends GeneratedMessageV3, S extends GeneratedMessageV3> void invokeAsync(String action, S value) throws SpawnException {
226+
public <T extends GeneratedMessageV3, S extends GeneratedMessageV3> void invokeAsync(String action, S value) throws ActorInvocationException {
227227
InvocationOpts opts = InvocationOpts.builder().async(true).build();
228228
invokeActor(action, value, null, Optional.of(opts));
229229
}
@@ -239,7 +239,7 @@ public <T extends GeneratedMessageV3, S extends GeneratedMessageV3> void invokeA
239239
* Please see the {@link io.eigr.spawn.api.InvocationOpts} class for more information
240240
* @since 0.0.1
241241
*/
242-
public <T extends GeneratedMessageV3, S extends GeneratedMessageV3> void invokeAsync(String action, S value, InvocationOpts opts) throws SpawnException {
242+
public <T extends GeneratedMessageV3, S extends GeneratedMessageV3> void invokeAsync(String action, S value, InvocationOpts opts) throws ActorInvocationException {
243243
InvocationOpts mergedOpts = InvocationOpts.builder()
244244
.async(true)
245245
.delaySeconds(opts.getDelaySeconds())
@@ -275,7 +275,7 @@ public boolean isUnNamedActor() {
275275
}
276276

277277
private <T extends GeneratedMessageV3, S extends GeneratedMessageV3> Optional<T> invokeActor(
278-
String cmd, S argument, Class<T> outputType, Optional<InvocationOpts> options) throws SpawnException {
278+
String cmd, S argument, Class<T> outputType, Optional<InvocationOpts> options) throws ActorInvocationException {
279279
Objects.requireNonNull(this.actorId, "ActorId cannot be null");
280280

281281
Protocol.InvocationRequest.Builder invocationRequestBuilder = Protocol.InvocationRequest.newBuilder();
@@ -314,7 +314,7 @@ private <T extends GeneratedMessageV3, S extends GeneratedMessageV3> Optional<T>
314314
this.getActorName(), status.getMessage());
315315
throw new ActorInvocationException(msg);
316316
case ACTOR_NOT_FOUND:
317-
throw new ActorNotFoundException("Actor not found.");
317+
throw new ActorInvocationException("Actor not found.");
318318
case OK:
319319
if (resp.hasValue() && Objects.nonNull(outputType)) {
320320
try {

src/main/java/io/eigr/spawn/internal/transport/client/SpawnClient.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
import io.eigr.functions.protocol.Protocol;
44
import io.eigr.spawn.api.exceptions.ActorCreationException;
5-
import io.eigr.spawn.api.exceptions.SpawnException;
5+
import io.eigr.spawn.api.exceptions.ActorInvocationException;
6+
import io.eigr.spawn.api.exceptions.ActorRegistrationException;
67

78
public interface SpawnClient {
89

9-
Protocol.RegistrationResponse register(Protocol.RegistrationRequest registration) throws SpawnException;
10+
Protocol.RegistrationResponse register(Protocol.RegistrationRequest registration) throws ActorRegistrationException;
1011
Protocol.SpawnResponse spawn(Protocol.SpawnRequest registration) throws ActorCreationException;
11-
Protocol.InvocationResponse invoke(Protocol.InvocationRequest request) throws SpawnException;
12+
Protocol.InvocationResponse invoke(Protocol.InvocationRequest request) throws ActorInvocationException;
1213
}
1314

0 commit comments

Comments
 (0)