Skip to content

feat: add seed via exception context - #113

Merged
pbrisbin merged 4 commits into
mainfrom
pb/annotate2
Aug 24, 2026
Merged

feat: add seed via exception context#113
pbrisbin merged 4 commits into
mainfrom
pb/annotate2

Conversation

@pbrisbin

@pbrisbin pbrisbin commented Jul 31, 2026

Copy link
Copy Markdown
Member

If using base >= 4.20, we now add the graphula seed as an annotation in the exception context12.

This will be present for all exceptions (closes #44), but it's not readily visible anywhere. It must be extracted specifically via hooks (see the tests). Therefore, this hasn't replaced the textual-addition to HUnitFailure, it is in addition to.

Footnotes

  1. https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Control-Exception-Context.html

  2. https://well-typed.com/blog/2026/05/lay-annotation-land/

@pbrisbin
pbrisbin requested a review from cdmren July 31, 2026 13:27
@cdmren

This comment was marked as resolved.

@pbrisbin

This comment was marked as resolved.

@pbrisbin

This comment was marked as outdated.

@pbrisbin
pbrisbin marked this pull request as ready for review August 3, 2026 19:41
@pbrisbin
pbrisbin requested a review from a team as a code owner August 3, 2026 19:41
Comment thread src/Graphula.hs Outdated
Comment thread src/Graphula.hs Outdated
cdmren

This comment was marked as resolved.

@pbrisbin

This comment was marked as resolved.

@cdmren cdmren left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See #115

@pbrisbin
pbrisbin enabled auto-merge (rebase) August 24, 2026 13:47
@pbrisbin

Copy link
Copy Markdown
Member Author

We need a third reviewer now because Chris is last pusher and it's my PR.

pbrisbin and others added 4 commits August 24, 2026 09:47
This moves the `throwIO` out of the function that is concretely
`HUnitFailure`. This is because I'll next be adding something that needs
to occur between those two points.
When using `base > 4.20` we add exception context that includes the
graphula seed. Closes #44 as best we can.

The information won't appear anywhere automatically, but can be pulled
out (e.g.) via `SpecHook` for those that know (see README). This is a
compromise. Given how `hspec` works today, any other method that would
make the seed more visible for non-expectation-failure exceptions comes
with too many negative trade-offs.
@pbrisbin
pbrisbin merged commit c1bdd32 into main Aug 24, 2026
19 checks passed
@pbrisbin
pbrisbin deleted the pb/annotate2 branch August 24, 2026 15:32
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.

Catch SomeException and decorate with seed

3 participants