refactor: extract publish configuration factory#205
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a5f20f268
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| }; | ||
|
|
||
| if (destination == PublishDestination.GitHub && string.IsNullOrWhiteSpace(request.UserName)) | ||
| throw new ArgumentException("UserName is required for GitHub. Please fix New-ConfigurationPublish and provide UserName", nameof(request)); |
There was a problem hiding this comment.
Use PSArgumentException for cmdlet-facing validation
The factory now throws ArgumentException for user input validation (for example missing UserName on GitHub), but New-ConfigurationPublish previously surfaced these as PSArgumentException; this changes the observable exception type for the same invalid input and can break existing PowerShell automation that catches PSArgumentException from this cmdlet. Since this method is now the cmdlet’s validation path, wrapping or rethrowing as PSArgumentException would preserve backward-compatible error behavior.
Useful? React with 👍 / 👎.
Summary
New-ConfigurationPublishrequest mapping and validation into a typed factoryValidation
dotnet test .\PowerForge.Tests\PowerForge.Tests.csproj -c Release --filter "PublishConfigurationFactoryTests|FormatConfigurationFactoryTests|ValidationConfigurationFactoryTests"pwsh .\Module\Build\Build-Module.ps1 -NoSign