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

raise HTTP 400 on IntegrityError during Clone #862

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rgaudin
Copy link
Member

@rgaudin rgaudin commented Nov 2, 2023

Fixes #844

Same behavior as for schedule creation (that API supports but UI does not)
@rgaudin rgaudin requested a review from benoit74 November 2, 2023 10:37
@rgaudin rgaudin self-assigned this Nov 2, 2023
Copy link
Collaborator

@benoit74 benoit74 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A test case is probably easy to add + would be beneficial.

try:
session.flush()
except IntegrityError:
raise BadRequest("Schedule name already exists")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this a bit risky, I'm afraid we might have other integrity constraints in the future and might forget to alter this message.

At least I would log a warning with the exact integrity issue so that we can discover this in the log, otherwise it will be difficult to debug.

Or I would analyze IntegrityError, check the issue is about the schedule name, raise this BadRequest only in this situation ; and raise a more generic IntegrityError for other situations (which do not exist today).

@kelson42
Copy link
Contributor

@benoit74 This is a very old PR, it would be good to consoder to treat it

@rgaudin
Copy link
Member Author

rgaudin commented Jul 28, 2024

We should probably close it. I think it was open in reaction to something that's not that important now

@rgaudin
Copy link
Member Author

rgaudin commented Jul 28, 2024

Issue is sill valid

@benoit74
Copy link
Collaborator

I think issue is still valid, and feedback has been provided in the review (quite minor, but still important). At this point I expected @rgaudin to finish the PR since he started the job. I don't mind to finish it if it is more appropriate.

@rgaudin
Copy link
Member Author

rgaudin commented Oct 19, 2024

@benoit74 please take over

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Detect duplicate schedule names when cloning a schedule
3 participants