/** * Creates a new {@code ThingErrorResponse} for the specified {@code dittoRuntimeException}. * * @param dittoRuntimeException the exception. * @return the response. * @throws NullPointerException if one of the arguments is {@code null}. */ public static ThingErrorResponse of(final DittoRuntimeException dittoRuntimeException) { return of(FALLBACK_THING_ID, dittoRuntimeException, dittoRuntimeException.getDittoHeaders()); }
/** * Creates a new {@code ThingErrorResponse} for the specified {@code dittoRuntimeException}. * * @param dittoRuntimeException the exception. * @return the response. * @throws NullPointerException if one of the arguments is {@code null}. */ public static ThingErrorResponse of(final DittoRuntimeException dittoRuntimeException) { return of(FALLBACK_THING_ID, dittoRuntimeException, dittoRuntimeException.getDittoHeaders()); }
/** * Creates a new {@code PolicyErrorResponse} for the specified {@code dittoRuntimeException}. * * @param dittoRuntimeException the exception. * @return the response. * @throws NullPointerException if one of the arguments is {@code null}. */ public static PolicyErrorResponse of(final DittoRuntimeException dittoRuntimeException) { return of("unknown:unknown", dittoRuntimeException, dittoRuntimeException.getDittoHeaders()); }
/** * Creates a new {@code PolicyErrorResponse} for the specified {@code dittoRuntimeException}. * * @param policyId the Policy ID related to the exception. * @param dittoRuntimeException the exception. * @return the response. * @throws NullPointerException if one of the arguments is {@code null}. */ public static PolicyErrorResponse of(final String policyId, final DittoRuntimeException dittoRuntimeException) { return new PolicyErrorResponse(policyId, dittoRuntimeException, dittoRuntimeException.getDittoHeaders()); }
/** * Creates a new {@code ConnectivityErrorResponse} for the specified {@code dittoRuntimeException}. * * @param dittoRuntimeException the exception. * @return the response. * @throws NullPointerException if one of the arguments is {@code null}. */ public static ConnectivityErrorResponse of(final DittoRuntimeException dittoRuntimeException) { return new ConnectivityErrorResponse(dittoRuntimeException, dittoRuntimeException.getDittoHeaders()); }
/** * Creates a new {@code ConnectivityErrorResponse} for the specified {@code dittoRuntimeException}. * * @param dittoRuntimeException the exception. * @return the response. * @throws NullPointerException if one of the arguments is {@code null}. */ public static ConnectivityErrorResponse of(final DittoRuntimeException dittoRuntimeException) { return new ConnectivityErrorResponse(dittoRuntimeException, dittoRuntimeException.getDittoHeaders()); }
/** * Creates a new {@code ThingErrorResponse} for the specified {@code dittoRuntimeException}. * * @param thingId the Thing ID which was related to the exception. * @param dittoRuntimeException the exception. * @return the response. * @throws NullPointerException if one of the arguments is {@code null}. */ public static ThingErrorResponse of(final String thingId, final DittoRuntimeException dittoRuntimeException) { return new ThingErrorResponse(thingId, dittoRuntimeException, dittoRuntimeException.getDittoHeaders()); }
/** * Creates a new {@code PolicyErrorResponse} for the specified {@code dittoRuntimeException}. * * @param policyId the Policy ID related to the exception. * @param dittoRuntimeException the exception. * @return the response. * @throws NullPointerException if one of the arguments is {@code null}. */ public static PolicyErrorResponse of(final String policyId, final DittoRuntimeException dittoRuntimeException) { return new PolicyErrorResponse(policyId, dittoRuntimeException, dittoRuntimeException.getDittoHeaders()); }
/** * Creates a new {@code ThingErrorResponse} for the specified {@code dittoRuntimeException}. * * @param thingId the Thing ID which was related to the exception. * @param dittoRuntimeException the exception. * @return the response. * @throws NullPointerException if one of the arguments is {@code null}. */ public static ThingErrorResponse of(final String thingId, final DittoRuntimeException dittoRuntimeException) { return new ThingErrorResponse(thingId, dittoRuntimeException, dittoRuntimeException.getDittoHeaders()); }
/** * Creates a new {@code PolicyErrorResponse} for the specified {@code dittoRuntimeException}. * * @param dittoRuntimeException the exception. * @return the response. * @throws NullPointerException if one of the arguments is {@code null}. */ public static PolicyErrorResponse of(final DittoRuntimeException dittoRuntimeException) { return of("unknown:unknown", dittoRuntimeException, dittoRuntimeException.getDittoHeaders()); }
private void handleDittoRuntimeException(final DittoRuntimeException exception) { handleDittoRuntimeException(exception, exception.getDittoHeaders()); }
private void handleDittoRuntimeException(final DittoRuntimeException exception) { handleDittoRuntimeException(exception, exception.getDittoHeaders()); }
private void handleDittoRuntimeException(final ActorRef delegateActor, final DittoRuntimeException cre) { LogUtil.enhanceLogWithCorrelationId(logger, cre.getDittoHeaders().getCorrelationId()); logger.info("Got 'DittoRuntimeException': {} {}", cre.getClass().getName(), cre.getMessage()); cre.getDittoHeaders().getCorrelationId().ifPresent(outstandingCommandCorrelationIds::remove); if (cre.getDittoHeaders().isResponseRequired()) { delegateActor.forward(cre, getContext()); } else { logger.debug("Requester did not require response (via DittoHeader '{}') - not sending one", DittoHeaderDefinition.RESPONSE_REQUIRED); } }
private void completeWithDittoRuntimeException(final DittoRuntimeException dre) { final HttpResponse responseWithoutHeaders = buildResponseWithoutHeadersFromDittoRuntimeException(dre); final HttpResponse response = enhanceResponseWithExternalDittoHeaders(responseWithoutHeaders, dre.getDittoHeaders()); completeWithResult(response); }
private void handleDittoRuntimeException(final DittoRuntimeException dittoRuntimeException) { LogUtil.enhanceLogWithCorrelationId(log, dittoRuntimeException); log.warning("Received DittoRuntimeException {} from {}: {}", dittoRuntimeException.getClass().getName(), getSender(), dittoRuntimeException); addCommandResponse(DevOpsErrorResponse.of(null, null, dittoRuntimeException.toJson(), dittoRuntimeException.getDittoHeaders())); }
private void handleDittoRuntimeException(final DittoRuntimeException dittoRuntimeException) { LogUtil.enhanceLogWithCorrelationId(log, dittoRuntimeException); log.warning("Received DittoRuntimeException {} from {}: {}", dittoRuntimeException.getClass().getName(), getSender(), dittoRuntimeException); addCommandResponse(DevOpsErrorResponse.of(null, null, dittoRuntimeException.toJson(), dittoRuntimeException.getDittoHeaders())); }
private void logDittoRuntimeException(final DittoRuntimeException dre) { if (dre.getDittoHeaders().getCorrelationId().isPresent()) { LogUtil.enhanceLogWithCorrelationId(logger, dre); } logger.info("DittoRuntimeException '{}': {}", dre.getErrorCode(), dre.getMessage()); }
public DittoRuntimeAssert hasDittoHeaders(final DittoHeaders expectedDittoHeaders) { isNotNull(); final DittoHeaders actualDittoHeaders = actual.getDittoHeaders(); assertThat(actualDittoHeaders) // .overridingErrorMessage( "Expected command headers of DittoRuntimeException to be \n<%s> but they were " + "\n<%s>", expectedDittoHeaders, actualDittoHeaders) // .isEqualTo(expectedDittoHeaders); return this; }
private void handleDittoRuntimeException(final DittoRuntimeException exception, final Map<String, String> dittoHeaders) { final ThingErrorResponse errorResponse = ThingErrorResponse.of(exception, DittoHeaders.newBuilder(exception.getDittoHeaders()) .putHeaders(dittoHeaders) .build()); enhanceLogUtil(exception); final String stackTrace = stackTraceAsString(exception); log.info("Got DittoRuntimeException '{}' when ExternalMessage was processed: {} - {}. StackTrace: {}", exception.getErrorCode(), exception.getMessage(), exception.getDescription().orElse(""), stackTrace); handleCommandResponse(errorResponse); }
private void handleDittoRuntimeException(final DittoRuntimeException exception, final Map<String, String> dittoHeaders) { final ThingErrorResponse errorResponse = ThingErrorResponse.of(exception, DittoHeaders.newBuilder(exception.getDittoHeaders()) .putHeaders(dittoHeaders) .build()); enhanceLogUtil(exception); final String stackTrace = stackTraceAsString(exception); log.info("Got DittoRuntimeException '{}' when ExternalMessage was processed: {} - {}. StackTrace: {}", exception.getErrorCode(), exception.getMessage(), exception.getDescription().orElse(""), stackTrace); handleCommandResponse(errorResponse); }