public final class ApiProxyUtils extends Object
ApiProxyUtils is a utility class with functions shared by ApiProxy delegates, e.g.
ApiProxyImpl, VmApiProxyDelegate.| Modifier and Type | Method and Description |
|---|---|
static com.google.apphosting.api.ApiProxy.ApiProxyException |
convertApiError(com.google.apphosting.base.protos.RuntimePb.APIResponse apiResponse,
String packageName,
String methodName,
com.google.common.flogger.GoogleLogger logger)
Convert APIResponse.getError() to the appropriate exception.
|
static com.google.apphosting.api.ApiProxy.ApiProxyException |
getApiError(String packageName,
String methodName,
com.google.apphosting.base.protos.api.RemoteApiPb.Response response,
com.google.common.flogger.GoogleLogger logger)
Provides a throwable exception for HTTP API transport-level RPC errors.
|
static com.google.apphosting.api.ApiProxy.ApiProxyException |
getApiError(String packageName,
String methodName,
com.google.apphosting.base.protos.RuntimePb.APIResponse apiResponse,
com.google.common.flogger.GoogleLogger logger)
Provides a throwable exception for HTTP API transport-level RPC errors.
|
static com.google.apphosting.api.ApiProxy.ApiProxyException |
getRpcError(String packageName,
String methodName,
com.google.apphosting.base.protos.Status.StatusProto status,
int applicationError,
String errorDetail,
Throwable cause)
Provides a throwable exception for HTTP API RPC user-application errors.
|
static com.google.apphosting.base.protos.RuntimePb.APIResponse.ERROR |
remoteApiErrorToApiResponseError(com.google.apphosting.base.protos.api.RemoteApiPb.Response responsePb)
Converts a RemoteApiPb RPC error code into an APIResponse error code.
|
static Optional<com.google.apphosting.api.ApiProxy.ApiProxyException> |
statusException(com.google.apphosting.base.protos.Status.StatusProto status,
String packageName,
String methodName,
Throwable cause)
Provides errors based on the status of the HTTP response.
|
public static com.google.apphosting.api.ApiProxy.ApiProxyException convertApiError(com.google.apphosting.base.protos.RuntimePb.APIResponse apiResponse,
String packageName,
String methodName,
com.google.common.flogger.GoogleLogger logger)
apiResponse - the APIResponsepackageName - the name of the API package.methodName - the name of the method within the API package.logger - the Logger used to create log messages.public static com.google.apphosting.api.ApiProxy.ApiProxyException getRpcError(String packageName, String methodName, com.google.apphosting.base.protos.Status.StatusProto status, int applicationError, String errorDetail, Throwable cause)
packageName - the package of the API being called, eg datastore_v3.methodName - the name of the method in the API being called, eg RunQuery.status - a status proto representing the response status.applicationError - error code representing the error.errorDetail - detailed message for the error.cause - exception to use as the cause (may be null).public static com.google.apphosting.api.ApiProxy.ApiProxyException getApiError(String packageName, String methodName, com.google.apphosting.base.protos.api.RemoteApiPb.Response response, com.google.common.flogger.GoogleLogger logger)
packageName - the package of the API being called, eg datastore_v3.methodName - the name of the method in the API being called, eg RunQuery.response - the response from the API server call.logger - the logger to use for logging warning messages.public static com.google.apphosting.api.ApiProxy.ApiProxyException getApiError(String packageName, String methodName, com.google.apphosting.base.protos.RuntimePb.APIResponse apiResponse, com.google.common.flogger.GoogleLogger logger)
packageName - the package of the API being called, eg datastore_v3.methodName - the name of the method in the API being called, eg RunQuery.apiResponse - the response from the API server call.logger - the logger to use for logging warning messages.public static Optional<com.google.apphosting.api.ApiProxy.ApiProxyException> statusException(com.google.apphosting.base.protos.Status.StatusProto status, String packageName, String methodName, Throwable cause)
status - a status proto representing the response status.packageName - the package of the API being called, eg datastore_v3.methodName - the name of the method in the API being called, eg RunQuery.cause - the exception to chain as the cause (may be null).public static com.google.apphosting.base.protos.RuntimePb.APIResponse.ERROR remoteApiErrorToApiResponseError(com.google.apphosting.base.protos.api.RemoteApiPb.Response responsePb)
responsePb - the response containing an error code to be converted.Copyright © 2022. All rights reserved.