Skip to content

Commit

Permalink
remove exception type getter
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhun Xu authored and Zhun Xu committed Oct 29, 2019
1 parent 2b345be commit 33a6437
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public ResponseEntity<String> handleUnauthorizedException(APIException exception
throws InvalidProtocolBufferException {

Status.Builder statusBuilder = Status.newBuilder();
statusBuilder.setCode(exception.getApiExceptionType().getId());
statusBuilder.setReason(exception.getApiExceptionType().getMessage());
statusBuilder.setCode(exception.getId());
statusBuilder.setReason(exception.getMessage());
statusBuilder.setInfo(exception.getInfo());
statusBuilder.setStatus(Status.StatusFlag.FAILURE);

Expand All @@ -43,6 +43,6 @@ public ResponseEntity<String> handleUnauthorizedException(APIException exception
String json;
json = ProtoBufUtils.toJson(message);
return new ResponseEntity<String>(
json, HttpStatus.valueOf(exception.getApiExceptionType().getHttpCode()));
json, HttpStatus.valueOf(exception.getHttpCode()));
}
}
24 changes: 4 additions & 20 deletions engine/src/main/java/io/seldon/engine/exception/APIException.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,6 @@ public enum ApiExceptionType {
this.message = message;
this.httpCode = httpCode;
}

public int getId() {
return id;
}

public String getMessage() {
return message;
}

public int getHttpCode() {
return httpCode;
}
};

ApiExceptionType apiExceptionType;
Expand All @@ -80,14 +68,6 @@ public APIException(int id, String message, int httpCode, String info) {
this.info = info;
}

public ApiExceptionType getApiExceptionType() {
return apiExceptionType;
}

public void setApiExceptionType(ApiExceptionType apiExceptionType) {
this.apiExceptionType = apiExceptionType;
}

public String getInfo() {
return info;
}
Expand All @@ -104,4 +84,8 @@ public String getMessage()
{
return message;
}
public int getHttpCode()
{
return httpCode;
}
}

0 comments on commit 33a6437

Please sign in to comment.