Skip to content

Commit ef02978

Browse files
committed
fix MigrateThingDefinition wot validation issue
1 parent cc4eaf1 commit ef02978

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

things/service/src/main/java/org/eclipse/ditto/things/service/persistence/actors/ThingPersistenceActor.java

+3-11
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.apache.pekko.japi.pf.ReceiveBuilder;
2525
import org.apache.pekko.persistence.RecoveryCompleted;
2626
import org.eclipse.ditto.base.model.acks.DittoAcknowledgementLabel;
27-
import org.eclipse.ditto.base.model.exceptions.DittoInternalErrorException;
2827
import org.eclipse.ditto.base.model.exceptions.DittoRuntimeException;
2928
import org.eclipse.ditto.base.model.exceptions.DittoRuntimeExceptionBuilder;
3029
import org.eclipse.ditto.base.model.headers.DittoHeaders;
@@ -153,22 +152,15 @@ public void onQuery(final Command<?> command, final WithDittoHeaders response) {
153152
public void onStagedQuery(final Command<?> command, final CompletionStage<WithDittoHeaders> response,
154153
@Nullable final StartedSpan startedSpan) {
155154
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);
165158
} else {
166159
doOnQuery(command, r, sender);
167160
}
168161
if (startedSpan != null) {
169162
startedSpan.finish();
170163
}
171-
return null;
172164
});
173165
}
174166

0 commit comments

Comments
 (0)