Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: create interface for pkgs to return codersdk errors#18719

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Emyrk merged 3 commits intomainfromstevenmasley/preview_errors
Jul 3, 2025

Conversation

Emyrk
Copy link
Member

@EmyrkEmyrk commentedJul 2, 2025
edited
Loading

The dynamic parameter code lives in a package far removed from the httpapi and handlers. This interface allows it to create rich codersdk errors and pass them up to thewsbuilder error handling.

This interface should probably be used in more places. I got tired of making custom error handling code for unique types.

@EmyrkGraphite App
Copy link
MemberAuthor

Emyrk commentedJul 2, 2025
edited
Loading

@EmyrkEmyrk changed the titlechore: interface for pkgs to return codersdk errorschore: create interface for pkgs to return codersdk errorsJul 2, 2025
@EmyrkEmyrkforce-pushed thestevenmasley/preview_errors branch 2 times, most recently fromb43bd8e to15a6ca1CompareJuly 2, 2025 15:54
@EmyrkEmyrkforce-pushed thestevenmasley/preview_errors branch 2 times, most recently fromf0dd768 toa87678dCompareJuly 2, 2025 16:48
@EmyrkEmyrk marked this pull request as ready for reviewJuly 2, 2025 17:30
@EmyrkEmyrk requested a review fromjohnstcnJuly 2, 2025 21:44
@EmyrkEmyrkforce-pushed thestevenmasley/preview_errors branch from96c83c7 to8d594a7CompareJuly 2, 2025 21:51
Copy link
Member

@johnstcnjohnstcn left a comment

Choose a reason for hiding this comment

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

I only have nits about naming and usage conventions, but these aren't blocking.

Comment on lines 31 to 32
Diagnostics hcl.Diagnostics
KeyedDiagnosticsmap[string]hcl.Diagnostics
Copy link
Member

Choose a reason for hiding this comment

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

nit: What's the difference betweenDiagnostics andKeyedDiagnostics?
When should you use one or the other?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I will leave more comments!

@EmyrkEmyrk requested a review fromCopilotJuly 3, 2025 12:10
Copy link
Contributor

@CopilotCopilotAI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a unified error interface and refactors workspace‐build and parameter validation errors to produce structuredcodersdk.Response payloads.

  • IntroduceCoderSDKError interface andIsCoderSDKError helper inhttperror/responserror.go
  • ImplementResponse() onBuildError and createDiagnosticError for dynamic parameters
  • Update HTTP error writer and tests to use the new interface

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
coderd/wsbuilder/wsbuilder_test.goAddedTestWsbuildError to verifyBuildError meets the new interface
coderd/wsbuilder/wsbuilder.goImplementedResponse() onBuildError for structured responses
coderd/httpapi/httperror/wsbuild.goSimplified error handling to useIsCoderSDKError
coderd/httpapi/httperror/responserror.goDefinedCoderSDKError interface andIsCoderSDKError function
coderd/dynamicparameters/resolver.goSwapped outResolverError for calls toParameterValidationError
coderd/dynamicparameters/error.goAddedDiagnosticError type, constructors, and response logic
Comments suppressed due to low confidence (3)

coderd/httpapi/httperror/responserror.go:9

  • Add a doc comment above theCoderSDKError interface explaining its purpose and usage to improve discoverability.
type CoderSDKError interface {

coderd/dynamicparameters/error.go:13

  • Add unit tests forParameterValidationError (and the resultingDiagnosticError.Response) to ensure validation error formatting remains correct.
func ParameterValidationError(diags hcl.Diagnostics) *DiagnosticError {

coderd/dynamicparameters/error.go:21

  • Include doc comments forTagValidationError and theDiagnosticError type to describe when and how these should be used.
func TagValidationError(diags hcl.Diagnostics) *DiagnosticError {

@EmyrkEmyrk merged commit699dd8e intomainJul 3, 2025
30 checks passed
@EmyrkEmyrk deleted the stevenmasley/preview_errors branchJuly 3, 2025 13:33
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsJul 3, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@johnstcnjohnstcnjohnstcn approved these changes

Copilot code reviewCopilotCopilot left review comments

Assignees

@EmyrkEmyrk

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@Emyrk@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp