Skip to content

Factor out bug report URL boilerplate into a utility function#1635

Open
stmontgomery wants to merge 1 commit intoswiftlang:mainfrom
stmontgomery:file-bug-helper
Open

Factor out bug report URL boilerplate into a utility function#1635
stmontgomery wants to merge 1 commit intoswiftlang:mainfrom
stmontgomery:file-bug-helper

Conversation

@stmontgomery
Copy link
Contributor

Many places in the codebase terminate the program (via fatalError, precondition, or assert) or throw SystemError and include a message asking the developer to file a bug report. The URL and surrounding boilerplate text for this request are duplicated verbatim across 18 call sites.

This PR factors this into a utility function to reduce repetition and make it easier to include these helpful messages consistently when adding new assertion sites in the future.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

@stmontgomery stmontgomery added this to the Swift 6.4.0 (main) milestone Mar 19, 2026
@stmontgomery stmontgomery self-assigned this Mar 19, 2026
@stmontgomery stmontgomery added enhancement New feature or request tech-debt 💾 reduces technical debt labels Mar 19, 2026
@grynspan
Copy link
Contributor

Does it need to be a function call? Can't it just be an internal global and we interpolate it in?

@grynspan
Copy link
Contributor

Or even better, just have SystemError and/or .system synthesize it?

@stmontgomery
Copy link
Contributor Author

SystemError/.system is just one of the several ways the URL string is used. And the helper function also formats the "and include this information: ..." suffix when relevant, so I find that valuable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request tech-debt 💾 reduces technical debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants