use of io.seldon.protos.PredictionProtos.Status in project seldon-core by SeldonIO.
the class ExceptionControllerAdvice method handleUnauthorizedException.
@ExceptionHandler(APIException.class)
public ResponseEntity<String> handleUnauthorizedException(APIException exception) throws InvalidProtocolBufferException {
Status.Builder statusBuilder = Status.newBuilder();
statusBuilder.setCode(exception.getApiExceptionType().getId());
statusBuilder.setReason(exception.getApiExceptionType().getMessage());
statusBuilder.setInfo(exception.getInfo());
statusBuilder.setStatus(Status.StatusFlag.FAILURE);
Status status = statusBuilder.build();
String json;
json = ProtoBufUtils.toJson(status);
return new ResponseEntity<String>(json, HttpStatus.valueOf(exception.getApiExceptionType().getHttpCode()));
}
use of io.seldon.protos.PredictionProtos.Status in project seldon-core by SeldonIO.
the class ExceptionControllerAdvice method handleUnauthorizedException.
@ExceptionHandler(SeldonAPIException.class)
public ResponseEntity<String> handleUnauthorizedException(SeldonAPIException exception) throws InvalidProtocolBufferException {
Status.Builder statusBuilder = Status.newBuilder();
statusBuilder.setCode(exception.getApiExceptionType().getId());
statusBuilder.setReason(exception.getApiExceptionType().getMessage());
statusBuilder.setInfo(exception.getInfo());
statusBuilder.setStatus(Status.StatusFlag.FAILURE);
Status status = statusBuilder.build();
String json;
json = ProtoBufUtils.toJson(status);
return new ResponseEntity<String>(json, HttpStatus.valueOf(exception.getApiExceptionType().getHttpCode()));
}
Aggregations