|
24 | 24 | import org.apache.pekko.japi.pf.ReceiveBuilder;
|
25 | 25 | import org.apache.pekko.persistence.RecoveryCompleted;
|
26 | 26 | import org.eclipse.ditto.base.model.acks.DittoAcknowledgementLabel;
|
27 |
| -import org.eclipse.ditto.base.model.exceptions.DittoInternalErrorException; |
28 | 27 | import org.eclipse.ditto.base.model.exceptions.DittoRuntimeException;
|
29 | 28 | import org.eclipse.ditto.base.model.exceptions.DittoRuntimeExceptionBuilder;
|
30 | 29 | import org.eclipse.ditto.base.model.headers.DittoHeaders;
|
@@ -153,22 +152,15 @@ public void onQuery(final Command<?> command, final WithDittoHeaders response) {
|
153 | 152 | public void onStagedQuery(final Command<?> command, final CompletionStage<WithDittoHeaders> response,
|
154 | 153 | @Nullable final StartedSpan startedSpan) {
|
155 | 154 | final ActorRef sender = getSender();
|
156 |
| - response.handle((r, throwable) -> { |
157 |
| - if (throwable != null ) { |
158 |
| - final DittoRuntimeException exception = DittoRuntimeException.asDittoRuntimeException(throwable, t -> |
159 |
| - DittoInternalErrorException.newBuilder() |
160 |
| - .cause(t) |
161 |
| - .dittoHeaders(command.getDittoHeaders()) |
162 |
| - .build() |
163 |
| - ); |
164 |
| - notifySender(sender, exception); |
| 155 | + response.whenComplete((r, throwable) -> { |
| 156 | + if (throwable instanceof DittoRuntimeException dittoRuntimeException) { |
| 157 | + notifySender(sender, dittoRuntimeException); |
165 | 158 | } else {
|
166 | 159 | doOnQuery(command, r, sender);
|
167 | 160 | }
|
168 | 161 | if (startedSpan != null) {
|
169 | 162 | startedSpan.finish();
|
170 | 163 | }
|
171 |
| - return null; |
172 | 164 | });
|
173 | 165 | }
|
174 | 166 |
|
|
0 commit comments