flyrain commented on code in PR #1181:
URL: https://github.com/apache/polaris/pull/1181#discussion_r1997473559


##########
service/common/src/main/java/org/apache/polaris/service/exception/IcebergExceptionMapper.java:
##########
@@ -191,6 +192,7 @@ static int mapExceptionToResponseCode(RuntimeException rex) 
{
       case IllegalArgumentException e -> Status.BAD_REQUEST.getStatusCode();
       case UnsupportedOperationException e -> 
Status.NOT_ACCEPTABLE.getStatusCode();
       case WebApplicationException e -> e.getResponse().getStatus();
+      case PersistenceException e -> Status.UNAUTHORIZED.getStatusCode();

Review Comment:
   This may not be enough to fix the issue, as line 105 to line 115 still leak 
the detailed database information.
   
   Another concern is that, the error log has gone after the change as we 
changed the `Status code` to 401. I think we still need to log an error in the 
server side.
   ```
       if (responseCode == 
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()) {
         LOGGER.error("Unhandled exception returning INTERNAL_SERVER_ERROR", 
runtimeException);
       }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to