/** * {@inheritDoc} */ @Override protected final PartialFunction<Throwable, Source<Boolean, NotUsed>> errorRecovery(final String thingId) { return new PFBuilder<Throwable, Source<Boolean, NotUsed>>() .matchAny(throwable -> { final String msgTemplate = "Update operation for <{}> failed due to"; if (isErrorOfType(MONGO_DUPLICATE_KEY_ERROR_CODE, throwable)) { // expected error - thus as DEBUG: log.debug(msgTemplate + " a duplicate key: {}", thingId, throwable.getMessage()); return Source.single(Boolean.FALSE); } else if (isErrorOfType(MONGO_INDEX_VALUE_ERROR_CODE, throwable)) { log.error(throwable, msgTemplate + " a too large value which cannot be indexed!", thingId); return Source.single(Boolean.TRUE); } else { log.error(throwable, msgTemplate + " an unexpected error: {}", thingId, throwable.getMessage()); return Source.failed(throwable); } }) .build(); }
/** * {@inheritDoc} */ @Override protected final PartialFunction<Throwable, Source<Boolean, NotUsed>> errorRecovery(final String thingId) { return new PFBuilder<Throwable, Source<Boolean, NotUsed>>() .matchAny(throwable -> { final String msgTemplate = "Update operation for <{}> failed due to"; if (isErrorOfType(MONGO_DUPLICATE_KEY_ERROR_CODE, throwable)) { // expected error - thus as DEBUG: log.debug(msgTemplate + " a duplicate key: {}", thingId, throwable.getMessage()); return Source.single(Boolean.FALSE); } else if (isErrorOfType(MONGO_INDEX_VALUE_ERROR_CODE, throwable)) { log.error(throwable, msgTemplate + " a too large value which cannot be indexed!", thingId); return Source.single(Boolean.TRUE); } else { log.error(throwable, msgTemplate + " an unexpected error: {}", thingId, throwable.getMessage()); return Source.failed(throwable); } }) .build(); }
} else if (query instanceof DittoRuntimeException) { log.info("QueryActor responded with DittoRuntimeException: {}", query); return Source.<Object>failed((Throwable) query); } else { log.error("Expected 'PolicyRestrictedSearchAggregation', but got: {}", query);
} else if (query instanceof DittoRuntimeException) { log.info("QueryActor responded with DittoRuntimeException: {}", query); return Source.<QueryThingsResponse>failed((Throwable) query); } else { log.error("Expected 'PolicyRestrictedSearchAggregation' or 'query', but got: {}",