Skip to content

Conversation

@grynspan
Copy link
Contributor

@grynspan grynspan commented Feb 7, 2025

This PR adds a (for now internal-only) protocol that lets us transform arbitrary errors to arbitrary issues (rather than always emitting them as .errorCaught). This protocol replaces the special-casing we were doing for SystemError and APIMisuseError.

This change also causes us to emit an API misuse issue if a developer passes an error of type ExpectationFailedError to Issue.record() as we can reasonably assume that such an error was already recorded correctly as .expectationFailed.

Checklist:

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

This PR adds a (for now internal-only) protocol that lets us transform arbitrary
errors to arbitrary issues (rather than always emitting them as `.errorCaught`).
This protocol replaces the special-casing we were doing for `SystemError` and
`APIMisuseError`.

This change also causes us to emit an API misuse issue if a developer passes an
error of type `ExpectationFailedError` to `Issue.record()` as we can reasonably
assume that such an error was already recorded correctly as `.expectationFailed`.
@grynspan grynspan added enhancement New feature or request issue-handling Related to Issue handling within the testing library labels Feb 7, 2025
@grynspan grynspan added this to the Swift 6.x milestone Feb 7, 2025
@grynspan grynspan self-assigned this Feb 7, 2025
@grynspan
Copy link
Contributor Author

grynspan commented Feb 7, 2025

@swift-ci test

grynspan and others added 2 commits February 11, 2025 12:39
Co-authored-by: Stuart Montgomery <smontgomery@apple.com>
Co-authored-by: Stuart Montgomery <smontgomery@apple.com>
@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan grynspan merged commit 55d0023 into main Feb 11, 2025
3 checks passed
@grynspan grynspan deleted the jgrynspan/CustomIssueRepresentable-protocol branch February 11, 2025 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request issue-handling Related to Issue handling within the testing library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants