Class SdkCall
java.lang.Object
co.ankatech.ankasecure.sdk.internal.util.SdkCall
Utility wrapper that executes a lambda calling the OpenAPI client and
uniformly maps any
ApiException
(or runtime failure) to
AnkaSecureSdkException
via ExceptionTranslator
.
return SdkCall.of("bundle.key", ctx, () -> openApi.doSomething(req), arg0, arg1);
-
Method Summary
-
Method Details
-
of
Executes a given task encapsulated as aCallable
, handling exceptions uniformly by translating them into anAnkaSecureSdkException
with optional localization.- Type Parameters:
R
- the type of the result produced by the callable task- Parameters:
bundleKey
- the key to a localized message in the resource bundle for exception translationctx
- a map containing additional context to include in case of an exceptiontask
- theCallable
task to executeargs
- optional arguments for formatting the localized message- Returns:
- the result produced by executing the provided task
- Throws:
AnkaSecureSdkException
- if the task execution fails, wrapping the original exception
-