Skip to content

Add missing short-circuit functions to result DSL#43

Closed
mrmans0n wants to merge 2 commits intomainfrom
feature/add-notstarted-dsl
Closed

Add missing short-circuit functions to result DSL#43
mrmans0n wants to merge 2 commits intomainfrom
feature/add-notstarted-dsl

Conversation

@mrmans0n
Copy link
Owner

This PR adds three missing short-circuit functions to the ResultScope DSL:

  1. notStarted(): Nothing - Short-circuits with NotStarted
  2. error(error: Error): Nothing - Short-circuits with the given Error instance (overload for existing error(Throwable))
  3. errorWithMetadata<T>(metadata: T, errorId: ErrorId?): Nothing - Short-circuits with an Error carrying typed metadata

Changes

  • Updated ResultScope interface with the three new functions
  • Updated interface KDoc to mention new functions
  • Implemented all three functions in ResultScopeImpl
  • Added comprehensive tests for each function

These functions provide more ergonomic ways to short-circuit in the result DSL, especially when working with Error instances directly or when you need to attach typed metadata.

Note: Local tests could not be run due to Java runtime unavailability on the development machine, but CI should validate the changes.

- Add notStarted() function to ResultScope interface
- Implement notStarted() in ResultScopeImpl to short-circuit with NotStarted
- Update ResultScope KDoc to mention notStarted in the list of provided functions
- Add test for notStarted() in AsyncResultResultDslTest
- Add notStarted() function to short-circuit with NotStarted
- Add error(Error) overload to short-circuit with Error instance
- Add errorWithMetadata() to short-circuit with typed metadata
- Update ResultScope KDoc to mention new functions
- Add tests for all three new functions
@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2026

PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-02-11 14:59 UTC

@mrmans0n
Copy link
Owner Author

Superseded by #44 which includes all changes

@mrmans0n mrmans0n closed this Feb 11, 2026
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.

1 participant