MCPcopy Create free account
hub / github.com/jwtk/jjwt / wrapFmt

Method wrapFmt

impl/src/main/java/io/jsonwebtoken/impl/lang/Functions.java:51–53  ·  view source on GitHub ↗

Wraps the specified function to ensure that if any exception occurs, it is of the specified type and/or with the specified message. If no exception occurs, the function's return value is returned as expected. If fn throws an exception, its type is checked. If it is already of type {@co

(CheckedFunction<T, R> fn, Class<E> exClass, String msg)

Source from the content-addressed store, hash-verified

49 * @return the wrapping function instance.
50 */
51 public static <T, R, E extends RuntimeException> Function<T, R> wrapFmt(CheckedFunction<T, R> fn, Class<E> exClass, String msg) {
52 return new PropagatingExceptionFunction<>(fn, exClass, new FormattedStringFunction<T>(msg));
53 }
54
55 public static <T, R, E extends RuntimeException> Function<T, R> wrap(Function<T, R> fn, Class<E> exClass, String fmt, Object... args) {
56 return new PropagatingExceptionFunction<>(new DelegatingCheckedFunction<>(fn), exClass, new FormattedStringSupplier(fmt, args));

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected