Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
handle unique violation in wsbuilder
  • Loading branch information
mafredri committed Jan 8, 2025
commit 7a703f0bcfa1db996b18cc3f17c133a43d4911be
4 changes: 4 additions & 0 deletions coderd/wsbuilder/wsbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,10 @@ func (b *Builder) buildTx(authFunc func(action policy.Action, object rbac.Object
code := http.StatusInternalServerError
if rbac.IsUnauthorizedError(err) {
code = http.StatusForbidden
} else if database.IsUniqueViolation(err) {
// Concurrent builds may result in duplicate
// workspace_builds_workspace_id_build_number_key.
code = http.StatusConflict
}
return BuildError{code, "insert workspace build", err}
}
Expand Down
Loading