Skip to content

Epoch: fix builder panics instead of returning an error#84

Merged
ichung08 merged 3 commits intomainfrom
isaacchung/cpp-411-builder-panics-instead-of-returning-an-error
Mar 23, 2026
Merged

Epoch: fix builder panics instead of returning an error#84
ichung08 merged 3 commits intomainfrom
isaacchung/cpp-411-builder-panics-instead-of-returning-an-error

Conversation

@ichung08
Copy link
Copy Markdown
Contributor

Description

Changed versionChangeBuilder.Build() (and its fluent delegate methods on typeBuilder, requestToNextVersionBuilder, and responseToPreviousVersionBuilder) from returning *VersionChange to returning (*VersionChange, error). The previous panic() when no types or custom transformers were configured is now a proper error return.

🎟 Issue(s)

A missing ForType() or custom transformer call caused a runtime panic, crashing the process rather than surfacing a recoverable error. This is P0 reliability: callers should be able to handle the misconfiguration without dying.

Fixes CPP-411

🧪 Functional Testing

Updated panic assertion in version_change_builder_test.go to assert on the returned error instead
Propagated error handling across ~75 call sites in version_change_test.go, integration_test.go, openapi/version_transformer_test.go, openapi/generator_test.go, and openapi/swag_integration_test.go
Updated all three example programs (basic, advanced, schema-generation) to handle the error return
go test ./... and go vet ./... pass clean

📸 Screenshots

📋 Checklist

  • Added/updated applicable tests
  • Added/updated examples in the examples/ directory
  • Updated any related documentation

@ichung08 ichung08 self-assigned this Mar 18, 2026
@ichung08 ichung08 requested a review from a team as a code owner March 18, 2026 00:28
@ichung08 ichung08 merged commit fd10b33 into main Mar 23, 2026
2 checks passed
@ichung08 ichung08 deleted the isaacchung/cpp-411-builder-panics-instead-of-returning-an-error branch March 23, 2026 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants