refactor: use specific error for agpl and prebuilds (#17591)

Follow-up PR to https://github.com/coder/coder/pull/17458
Addresses this discussion:
https://github.com/coder/coder/pull/17458#discussion_r2055940797
This commit is contained in:
Yevhenii Shcherbina
2025-04-28 16:37:41 -04:00
committed by GitHub
parent 1da27a1ebc
commit a78f0fc4e1
4 changed files with 36 additions and 5 deletions
+4 -1
View File
@@ -9,7 +9,10 @@ import (
"github.com/coder/coder/v2/coderd/database"
)
var ErrNoClaimablePrebuiltWorkspaces = xerrors.New("no claimable prebuilt workspaces found")
var (
ErrNoClaimablePrebuiltWorkspaces = xerrors.New("no claimable prebuilt workspaces found")
ErrAGPLDoesNotSupportPrebuiltWorkspaces = xerrors.New("prebuilt workspaces functionality is not supported under the AGPL license")
)
// ReconciliationOrchestrator manages the lifecycle of prebuild reconciliation.
// It runs a continuous loop to check and reconcile prebuild states, and can be stopped gracefully.
+1 -1
View File
@@ -27,7 +27,7 @@ type NoopClaimer struct{}
func (NoopClaimer) Claim(context.Context, uuid.UUID, string, uuid.UUID) (*uuid.UUID, error) {
// Not entitled to claim prebuilds in AGPL version.
return nil, ErrNoClaimablePrebuiltWorkspaces
return nil, ErrAGPLDoesNotSupportPrebuiltWorkspaces
}
func (NoopClaimer) Initiator() uuid.UUID {