Skip to content

Conversation

@pbrisbin
Copy link
Member

This adds *Either versions of our two insert functions in the frontend
class, which return Left String errors, rather than Nothings.

We define the maybe and either versions in terms of each other, making
this a backwards-compatible change, and use MINIMAL to ensure one or
the other always gets defined.

Then, we update our own instance to define either variants, with
informative messages for the failing cases.

Lastly, by using those either variants within the main loop, we can
collect (at least the final) Left value and report it as part of the
GenerationFailure.

The new README test confirms it works and shows what such an exception
will look like now.

Fixes #17.

@pbrisbin pbrisbin requested a review from chris-martin June 17, 2025 18:18
@pbrisbin pbrisbin marked this pull request as ready for review June 17, 2025 18:18
@pbrisbin pbrisbin requested a review from a team as a code owner June 17, 2025 18:18
@pbrisbin pbrisbin enabled auto-merge (rebase) June 18, 2025 17:39
This adds `*Either` versions of our two insert functions in the frontend
class, which return `Left String` errors, rather than `Nothing`s.

We define the maybe and either versions in terms of each other, making
this a backwards-compatible change, and use `MINIMAL` to ensure one or
the other always gets defined.

Then, we update our own instance to define either variants, with
informative messages for the failing cases.

Lastly, by using those either variants within the main loop, we can
collect (at least the final) `Left` value and report it as part of the
`GenerationFailure`.

The new README test confirms it works and shows what such an exception
will look like now.

Fixes #17.
@pbrisbin pbrisbin merged commit 527fa90 into main Jun 18, 2025
11 checks passed
@pbrisbin pbrisbin deleted the pb/insert-errors branch June 18, 2025 17:43
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.

Provide more transparent errors for generation failure

3 participants