All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.lognet.springboot.grpc.GRpcErrorHandler Maven / Gradle / Ivy

There is a newer version: 5.1.5
Show newest version
// Generated by delombok at Mon Jul 31 05:34:41 UTC 2023
package org.lognet.springboot.grpc;

import io.grpc.Metadata;
import io.grpc.Status;

/** Please use {@link org.lognet.springboot.grpc.recovery.GRpcExceptionHandler} instead */
@Deprecated
public class GRpcErrorHandler {
  @java.lang.SuppressWarnings("all")
  private static final org.slf4j.Logger log =
      org.slf4j.LoggerFactory.getLogger(GRpcErrorHandler.class);

  /**
   * @param status
   * @param exception
   * @param requestHeaders
   * @param responseHeaders - to be filled by implementor with trails meant to be sent to client
   * @return
   */
  public Status handle(
      Status status, Exception exception, Metadata requestHeaders, Metadata responseHeaders) {
    return handle(null, status, exception, requestHeaders, responseHeaders);
  }

  /**
   * @param message - request message
   * @param status
   * @param exception
   * @param requestHeaders
   * @param responseHeaders - to be filled by implementor with trails meant to be sent to client
   * @return
   */
  public Status handle(
      Object message,
      Status status,
      Exception exception,
      Metadata requestHeaders,
      Metadata responseHeaders) {
    log.error("Got error with status {} ", status.getCode().name(), exception);
    return status.withDescription(exception.getMessage());
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy