-
Notifications
You must be signed in to change notification settings - Fork 989
refactor: use specific error for agpl and prebuilds #17591
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
Changes from 5 commits
b0a025e
71d66af
bec0fdc
522a28a
a4954e4
ffac933
2812eec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -650,8 +650,15 @@ func createWorkspace( | |
if req.TemplateVersionPresetID != uuid.Nil { | ||
// Try and claim an eligible prebuild, if available. | ||
claimedWorkspace, err = claimPrebuild(ctx, prebuildsClaimer, db, api.Logger, req, owner) | ||
if err != nil && !errors.Is(err, prebuilds.ErrNoClaimablePrebuiltWorkspaces) { | ||
return xerrors.Errorf("claim prebuild: %w", err) | ||
// If claiming fails with an expected error (no claimable prebuilds or AGPL does not support prebuilds), | ||
// we fall back to creating a new workspace. Otherwise, propagate the unexpected error. | ||
if err != nil && | ||
!errors.Is(err, prebuilds.ErrNoClaimablePrebuiltWorkspaces) && | ||
!errors.Is(err, prebuilds.ErrAGPLDoesNotSupportPrebuiltWorkspaces) { | ||
api.Logger.Error(ctx, "failed to claim prebuilt workspace", slog.Error(err), | ||
slog.F("workspace_name", req.Name), slog.F("template_version_preset_id", req.TemplateVersionPresetID)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I should've been more clear, sorry. I meant we should log when the error is of one of the expected types. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds reasonable. Warning for expected cases, error for unexpected 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dannykopping it became too wordy, but I guess it's okay? |
||
|
||
return xerrors.Errorf("failed to claim prebuilt workspace: %w", err) | ||
} | ||
} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.