fabio-rizzo-01 commented on code in PR #1989: URL: https://github.com/apache/polaris/pull/1989#discussion_r2222882769
########## service/common/src/main/java/org/apache/polaris/service/exception/PolarisExceptionMapper.java: ########## @@ -45,23 +46,19 @@ public class PolarisExceptionMapper implements ExceptionMapper<PolarisException> private static final Logger LOGGER = LoggerFactory.getLogger(PolarisExceptionMapper.class); private Response.Status getStatus(PolarisException exception) { - if (exception instanceof AlreadyExistsException) { - return Response.Status.CONFLICT; - } else if (exception instanceof InvalidPolicyException) { - return Response.Status.BAD_REQUEST; - } else if (exception instanceof PolicyAttachException) { - return Response.Status.BAD_REQUEST; - } else if (exception instanceof NoSuchPolicyException) { - return Response.Status.NOT_FOUND; - } else if (exception instanceof PolicyVersionMismatchException) { - return Response.Status.CONFLICT; - } else if (exception instanceof PolicyMappingAlreadyExistsException) { - return Response.Status.CONFLICT; - } else if (exception instanceof PolicyInUseException) { - return Response.Status.BAD_REQUEST; - } else { - return Response.Status.INTERNAL_SERVER_ERROR; - } + return switch (exception) { + case AlreadyExistsException alreadyExistsException -> Response.Status.CONFLICT; + case CommitConflictException commitConflictException -> Response.Status.REQUEST_TIMEOUT; Review Comment: I think with the custom exception we can return 500 at this point, what do you think? -- 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: issues-unsubscr...@polaris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org