-
Notifications
You must be signed in to change notification settings - Fork 881
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
refactor: use specific error for agpl and prebuilds #17591
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a couple nits
coderd/workspaces.go
Outdated
!errors.Is(err, prebuilds.ErrAGPLDoesNotSupportPrebuilds) { | ||
!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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
- maybe let's log in both cases? Because if unexpected error is happened it also make sense to log? Or it will be logged on another level because handler failed?
- do you want to log it with error or warning? Because
ErrNoClaimablePrebuiltWorkspaces
is not an actual error? It can be normal situation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
@dannykopping it became too wordy, but I guess it's okay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
…ebuild-follow-up-2
Follow-up PR to #17458
Addresses this discussion: #17458 (comment)