We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The application should give an error message that the object cannot be deleted due to the violated foreign key constraint.
The application prints a whole stack trace, which would only be helpful for developers but not for normal users
By surrounding the method call delete() with a try-catch block in the Controller-Template the problem would be fixed:
delete()
import org.springframework.dao.DataIntegrityViolationException ... def delete(${className} ${propertyName}) { ... try { ${propertyName}.delete(flush: true) flash.message = message(code: 'default.deleted.message', args: [message(code: '${propertyName}.label', default: '${className}'), params.id]) redirect(action: "index") }catch (DataIntegrityViolationException e) { flash.message = message(code: 'default.not.deleted.message', args: [message(code: '${propertyName}.label', default: '${className}'), params.id]) redirect(action: "show", id: params.id) } }
See attachment
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Steps to Reproduce
Expected Behaviour
The application should give an error message that the object cannot be deleted due to the violated foreign key constraint.
Actual Behaviour
The application prints a whole stack trace, which would only be helpful for developers but not for normal users
How It Can Be Fixed
By surrounding the method call
delete()
with a try-catch block in the Controller-Template the problem would be fixed:Environment Information
Example Application
See attachment
The text was updated successfully, but these errors were encountered: