Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 7 commits into from
Apr 28, 2025

Conversation

evgeniy-scherbina
Copy link
Contributor

@evgeniy-scherbina evgeniy-scherbina commented Apr 28, 2025

Follow-up PR to #17458
Addresses this discussion: #17458 (comment)

@evgeniy-scherbina evgeniy-scherbina marked this pull request as ready for review April 28, 2025 18:38
Copy link
Contributor

@dannykopping dannykopping left a 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

!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))
Copy link
Contributor

@dannykopping dannykopping Apr 28, 2025

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 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?
  2. do you want to log it with error or warning? Because ErrNoClaimablePrebuiltWorkspaces is not an actual error? It can be normal situation.

Copy link
Contributor

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 👍

Copy link
Contributor Author

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?

Copy link
Contributor

@dannykopping dannykopping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@evgeniy-scherbina evgeniy-scherbina merged commit a78f0fc into main Apr 28, 2025
34 checks passed
@evgeniy-scherbina evgeniy-scherbina deleted the yevhenii/512-claim-prebuild-follow-up-2 branch April 28, 2025 20:37
@github-actions github-actions bot locked and limited conversation to collaborators Apr 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants