Private constructorOptional Readonly errorReadonly isTrue if the Result represents a failure.
Will always be opposite to isSuccess.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/is-failure.html
Readonly isTrue if the Result represents success.
Will always be opposite to isFailure.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/is-failure.html
Optional Readonly resultReturns the Result's error if the failed, or undefined if it succeeded.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/exception-or-null.html
Map's the current Result using onSuccess or onFailure. Returns the result of the evaluation.
The function passed on onSuccess is used is used to map the current Result if it represents a success. If so, the current value is used as the value parameter.
The function passed on onFailure is used is used to map the current Result if it represents a failure. If so, the current error is used as the error parameter.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/fold.html
Returns the Result's value if it succeeded, or the passed value if it failed.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/get-or-default.html
The value to return in case the Result represents a failure.
Returns the Result's value if it succeeded.
If the result represents a failure, evaluates onFailure with the occurred error as parameter and returns the result of the evaluation.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/get-or-else.html
Returns the Result's value if it succeeded, or throw the Result's error if it failed.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/get-or-throw.html
Returns the Result's value if it succeeded, or undefined if it failed.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/get-or-null.html
Transforms the value of the Result if it represents a success. If not, returns the current result.
The function on transform is used to transform the value in case the result represents success. If so, the value argument of this callback function will be the current value of the Result.
This operation does not mutate the current Result, instead returns a new one with the return of value wrapped.
If the current Result represents an error, the current result is returned unchanged.
If the evaluation of the transform function fails, the error will be left uncatched.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/map.html
The callback to be used to transform the current result.
Transforms the value of the Result if it represents a failure. If not, returns the current result.
The function on transform is used to transform the value in case the result represents success. If so, the value argument of this callback function will be the current value of the Result.
This operation does not mutate the current Result, instead returns a new one with the return of value wrapped.
If the current result represents an error, the current result is returned unchanged.
If the evaluation of the transform function fails, the Result returned will be a failure with the exception as it's wrapped error.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/map-catching.html
The callback to be used to transform the current result.
Transforms the error of the Result if it represents a failure. If not, returns the current result.
The function on transform is used to transform the value in case the result represents success. If so, the error argument of this callback function will be the current error of the Result.
This operation does not mutate the current Result, instead returns a new one with the return of value wrapped as error.
If the current Result represents a success, the current result is returned unchanged.
If the evaluation of the transform function fails, the error will be left uncatched.
The callback to be used to transform the current error.
Executes the callback in the action parameter if the current result represents a failure. Always returns the current error unchanged, regardless of the result of the action callback.
The error parameter of the callback action is the error that the current Result is wrapping.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/on-failure.html
The callback to be executed case the current Result represents a failure.
Executes the callback in the action parameter if the current result represents a succeeded. Always returns the current error unchanged, regardless of the result of the action callback.
The value parameter of the callback action is the value that the current Result is wrapping.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/on-success.html
The callback to be executed case the current Result represents a succeeded operation.
Executes the callback transform if the current Result represents a failure and returns it result. Returns the current unchanged Result if it represents a success.
The error parameter of the transform callback is the error that the current Result is wrapping.
This function does not catches any errors thrown in the transform callback.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/recover.html
Executes the callback transform if the current Result represents a failure and returns it result. Returns the current unchanged Result if it represents a success.
The error parameter of the transform callback is the error that the current Result is wrapping.
This function catches any errors thrown in the transform callback, and if there are any, the returned Results will be a failure with the error that was thrown wrapped in it.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/recover-catching.html
Static failureCreates a failed Result with the given error.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/failure.html
The error to use in the Result.
Static successCreates a succeeded Result with the given value.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/failure.html
The value to use in the Result.
Generated using TypeDoc
Wraps the evaluation of an operation, which could either succeed with (or without) a result or fail with (or without) an error.
This class is always an immutable data structure.
See
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/