BLOG-133 Unique label name and semantic ID #135
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "BLOG-133_unique_label_name"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
409 CONFLICT
if there is already a label with same name or a post with same semantic ID.Package Changes
No response
Screenshots
No response
Reference
Resolves #133.
Checklist
/improve
PR Code Suggestions ✨
Return 409 for duplicate semantic ID
The
PostError::DuplicatedSemanticId
error indicates a client-side conflict, not aserver-side issue. It should return an
HttpResponse::Conflict()
(409 status code)instead of
HttpResponse::InternalServerError()
(500 status code). This provides amore accurate and actionable response to the client.
backend/feature/post/src/framework/web/create_label_handler.rs [38-43]
Suggestion importance[1-10]: 9
__
Why: The suggestion correctly identifies that
PostError::DuplicatedSemanticId
should result in anHttpResponse::Conflict()
(409) as it's a client-side data conflict, not an internal server error. This improves the API's error reporting accuracy.Return 409 for duplicate label name
The
PostError::DuplicatedLabelName
error signifies a client-side conflict whencreating a post, not an internal server error. It should return an
HttpResponse::Conflict()
(409 status code) to correctly inform the client about theduplicate resource.
backend/feature/post/src/framework/web/create_post_handler.rs [41-44]
Suggestion importance[1-10]: 9
__
Why: Similar to the previous suggestion,
PostError::DuplicatedLabelName
indicates a client-side conflict, makingHttpResponse::Conflict()
(409) the appropriate response. This enhances the API's semantic correctness for error handling.