Skip to content

Add Custom Messages to Errors#140

Open
rcosta358 wants to merge 3 commits intomainfrom
custom-messages
Open

Add Custom Messages to Errors#140
rcosta358 wants to merge 3 commits intomainfrom
custom-messages

Conversation

@rcosta358
Copy link
Collaborator

@rcosta358 rcosta358 commented Feb 5, 2026

This PR adds support for custom messages in refinements and state refinements, through an extra parameter msg:

@Refinement(value="...", msg="...")
@StateRefinement(from="...", to="...", msg="...")

Examples

image image image

In the last example, the close method is annotated with two state refinements, each with its own message, so both are shown. However, to simplify the error message, users should specify a message in only one of them, e.g., "The buffered reader should be open or marked to be closed".

@rcosta358 rcosta358 self-assigned this Feb 5, 2026
@rcosta358 rcosta358 added enhancement New feature or request error messages labels Feb 5, 2026
@rcosta358 rcosta358 changed the title Add Custom Messages Add Custom Messages to Errors Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request error messages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant