99import io .eigr .functions .protocol .actors .ActorOuterClass ;
1010import io .eigr .spawn .api .exceptions .ActorCreationException ;
1111import io .eigr .spawn .api .exceptions .ActorInvocationException ;
12+ import io .eigr .spawn .api .exceptions .ActorNotFoundException ;
1213import io .eigr .spawn .api .exceptions .SpawnException ;
1314import io .eigr .spawn .internal .transport .client .SpawnClient ;
1415
@@ -119,7 +120,7 @@ private static void spawnActor(ActorOuterClass.ActorId actorId, SpawnClient clie
119120 * @return an Optional containing, or not, the response object to the Action call
120121 * @since 0.0.1
121122 */
122- public <T extends GeneratedMessageV3 > Optional <T > invoke (String action , Class <T > outputType ) throws SpawnException {
123+ public <T extends GeneratedMessageV3 > Optional <T > invoke (String action , Class <T > outputType ) throws ActorInvocationException {
123124 Optional <T > res = invokeActor (action , Empty .getDefaultInstance (), outputType , Optional .empty ());
124125 return res .map (outputType ::cast );
125126
@@ -137,7 +138,7 @@ public <T extends GeneratedMessageV3> Optional<T> invoke(String action, Class<T>
137138 * @return an Optional containing, or not, the response object to the Action call
138139 * @since 0.0.1
139140 */
140- public <T extends GeneratedMessageV3 > Optional <T > invoke (String action , Class <T > outputType , InvocationOpts opts ) throws SpawnException {
141+ public <T extends GeneratedMessageV3 > Optional <T > invoke (String action , Class <T > outputType , InvocationOpts opts ) throws ActorInvocationException {
141142 Optional <T > res = invokeActor (action , Empty .getDefaultInstance (), outputType , Optional .ofNullable (opts ));
142143 return res .map (outputType ::cast );
143144
@@ -154,7 +155,7 @@ public <T extends GeneratedMessageV3> Optional<T> invoke(String action, Class<T>
154155 * @return an Optional containing, or not, the response object to the Action call
155156 * @since 0.0.1
156157 */
157- public <T extends GeneratedMessageV3 , S extends GeneratedMessageV3 > Optional <T > invoke (String action , S value , Class <T > outputType ) throws SpawnException {
158+ public <T extends GeneratedMessageV3 , S extends GeneratedMessageV3 > Optional <T > invoke (String action , S value , Class <T > outputType ) throws ActorInvocationException {
158159 Optional <T > res = invokeActor (action , value , outputType , Optional .empty ());
159160 return res .map (outputType ::cast );
160161
@@ -173,7 +174,7 @@ public <T extends GeneratedMessageV3, S extends GeneratedMessageV3> Optional<T>
173174 * @return an Optional containing, or not, the response object to the Action call
174175 * @since 0.0.1
175176 */
176- public <T extends GeneratedMessageV3 , S extends GeneratedMessageV3 > Optional <T > invoke (String action , S value , Class <T > outputType , InvocationOpts opts ) throws SpawnException {
177+ public <T extends GeneratedMessageV3 , S extends GeneratedMessageV3 > Optional <T > invoke (String action , S value , Class <T > outputType , InvocationOpts opts ) throws ActorInvocationException {
177178 Optional <T > res = invokeActor (action , value , outputType , Optional .ofNullable (opts ));
178179 return res .map (outputType ::cast );
179180
@@ -187,7 +188,7 @@ public <T extends GeneratedMessageV3, S extends GeneratedMessageV3> Optional<T>
187188 * @param action name of the action to be called.
188189 * @since 0.0.1
189190 */
190- public <T extends GeneratedMessageV3 > void invokeAsync (String action ) throws SpawnException {
191+ public <T extends GeneratedMessageV3 > void invokeAsync (String action ) throws ActorInvocationException {
191192 InvocationOpts opts = InvocationOpts .builder ().async (true ).build ();
192193 invokeActor (action , Empty .getDefaultInstance (), null , Optional .of (opts ));
193194 }
@@ -313,7 +314,7 @@ private <T extends GeneratedMessageV3, S extends GeneratedMessageV3> Optional<T>
313314 this .getActorName (), status .getMessage ());
314315 throw new ActorInvocationException (msg );
315316 case ACTOR_NOT_FOUND :
316- throw new ActorInvocationException ("Actor not found." );
317+ throw new ActorNotFoundException ("Actor not found." );
317318 case OK :
318319 if (resp .hasValue () && Objects .nonNull (outputType )) {
319320 try {
0 commit comments