Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bad json should be 400 not 500 #944

Merged
merged 3 commits into from
Oct 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ approvers:
- gsunner
- cliveseldon
- ryandawsonuk
- adriangonz
reviewers:
- axsaucedo
- gsunner
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ private ResponseEntity<String> _predictions(String json)
throw new APIException(ApiExceptionType.ENGINE_EXECUTION_FAILURE,e.getMessage());
}
} catch (InvalidProtocolBufferException e) {
throw new APIException(ApiExceptionType.ENGINE_INVALID_JSON,"");
throw new APIException(ApiExceptionType.ENGINE_INVALID_RESPONSE_JSON,"");
}
}

Expand Down Expand Up @@ -292,7 +292,7 @@ public ResponseEntity<String> feedback(RequestEntity<String> requestEntity) {
throw new APIException(ApiExceptionType.ENGINE_EXECUTION_FAILURE,e.getMessage());
}
} catch (InvalidProtocolBufferException e) {
throw new APIException(ApiExceptionType.ENGINE_INVALID_JSON,"");
throw new APIException(ApiExceptionType.ENGINE_INVALID_RESPONSE_JSON,"");
}
}
finally
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public class APIException extends RuntimeException {

public enum ApiExceptionType {

ENGINE_INVALID_JSON(201,"Invalid JSON",500),
ENGINE_INVALID_JSON(201,"Invalid JSON",400),
ENGINE_INVALID_RESPONSE_JSON(201,"Invalid Response JSON",500),
ENGINE_INVALID_ENDPOINT_URL(202,"Invalid Endpoint URL",500),
ENGINE_MICROSERVICE_ERROR(203,"Microservice error",500),
ENGINE_INVALID_ABTEST(204,"Error happened in AB Test Routing",500),
Expand Down