Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2024 The Dapr Authors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
limitations under the License.
*/
package io.dapr.exceptions;
import com.google.rpc.Status;
import io.dapr.internal.exceptions.DaprHttpException;
import io.grpc.StatusRuntimeException;
import io.grpc.protobuf.StatusProto;
import reactor.core.Exceptions;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
/**
* A Dapr's specific exception.
*/
public class DaprException extends RuntimeException {
/**
* Dapr's error code for this exception.
*/
private final String errorCode;
/**
* The status details for the error.
*/
private final DaprErrorDetails errorDetails;
/**
* Optional payload, if the exception came from a response body.
*/
private final byte[] payload;
/**
* Optional HTTP status code, if error happened for an HTTP call (0 if not set).
*/
private final int httpStatusCode;
/**
* New exception from a server-side generated error code and message.
*
* @param daprError Server-side error.
* @param payload Optional payload containing the error.
* @param httpStatusCode Optional http Status Code (0 if not set).
*/
public DaprException(DaprError daprError, byte[] payload, int httpStatusCode) {
this(daprError.getErrorCode(), daprError.getMessage(), daprError.getDetails(), payload, httpStatusCode);
}
/**
* New exception from a server-side generated error code and message.
* @param daprError Client-side error.
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
*/
public DaprException(DaprError daprError, Throwable cause) {
this(daprError.getErrorCode(), daprError.getMessage(), cause);
}
/**
* Wraps an exception into a DaprException.
* @param exception the exception to be wrapped.
*/
public DaprException(Throwable exception) {
this("UNKNOWN", exception.getMessage(), exception);
}
/**
* New Exception from a client-side generated error code and message.
*
* @param errorCode Client-side error code.
* @param message Client-side error message.
* @param payload Optional payload containing the error.
* @param httpStatusCode Optional http Status Code (0 if not set).
*/
public DaprException(String errorCode, String message, byte[] payload, int httpStatusCode) {
this(errorCode, message, DaprErrorDetails.EMPTY_INSTANCE, payload, httpStatusCode);
}
/**
* New Exception from a client-side generated error code and message.
*
* @param errorCode Client-side error code.
* @param message Client-side error message.
* @param errorDetails Details of the error from runtime.
* @param payload Optional payload containing the error.
* @param httpStatusCode Optional http Status Code (0 if not set).
*/
public DaprException(
String errorCode, String message, List