jerryshao opened a new issue, #14017:
URL: https://github.com/apache/gravitino/issues/14017

   ### Version
   
   main branch
   
   ### Describe what's wrong
   
   When a job template is renamed to a name that already exists, 
`JobManager.alterJobTemplate` catches `EntityAlreadyExistsException` and 
rethrows a plain `RuntimeException`. The REST job template exception handler 
only maps `JobTemplateAlreadyExistsException` to 409, so the request returns 
500 and the server logs an ERROR with a stack trace. The message is also built 
from an `Optional<String>`, so it prints `Optional[...]` instead of the new 
name.
   
   Clients cannot tell a name conflict from a server fault.
   
   ### Error message and/or stacktrace
   
   ```
   Failed to rename job template from template_a to Optional[template_b] under 
metalake test_metalake, the new name already exists
   ```
   
   ### How to reproduce
   
   1. Register job templates `template_a` and `template_b`.
   2. Alter `template_a` with `JobTemplateChange.rename("template_b")`.
   3. The server returns 500 instead of 409 
(`JobTemplateAlreadyExistsException`).
   
   ### Additional context
   
   _No response_
   


-- 
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