Skip to content

How to intentionally fail a task during the task execution? #2821

Answered by lefou
jk-1 asked this question in Q&A
Discussion options

You must be logged in to vote

Thrown exceptions are automatically lifted to Result.Exception. Alternatively, you can explicitly return a Result.Failure and give a meaningful error message. The only downside is, that the compiler is no longer automatically converting the success case into a Result, so you need to wrap the successful return value in a Result.Success.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@jk-1
Comment options

@jk-1
Comment options

@lefou
Comment options

Answer selected by jk-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants