Skip to content

Instantly share code, notes, and snippets.

@akihisa-shimada
Last active August 24, 2023 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akihisa-shimada/1b29941a7a4c17d37b10d6486db7ac72 to your computer and use it in GitHub Desktop.
Save akihisa-shimada/1b29941a7a4c17d37b10d6486db7ac72 to your computer and use it in GitHub Desktop.
package com.example.proto.grpc.exception.message;
import com.google.protobuf.Message;
import io.grpc.Status;
import java.util.LinkedHashMap;
import java.util.Objects;
/**
* 特定のgRPCレスポンスのための例外クラスです。
*
* @see org.springframework.web.server.ResponseStatusException
*/
public class ResponseStatusException extends RuntimeException {
final Status status;
LinkedHashMap<String, Object[]> details;
public ResponseStatusException(Status status, String message) {
super(message);
this.status = status;
this.details = null;
}
public ResponseStatusException(Status status, String message, Throwable cause) {
super(message, cause);
this.status = status;
this.details = null;
}
public ResponseStatusException(Status status, String message, LinkedHashMap<String, Object[]> details) {
super(message);
this.status = status;
this.details = details;
}
public Status getStatus() {
return status;
}
public LinkedHashMap<String, Object[]> getDetails() {
return details;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment