Failure

utils.Result.Failure
final case class Failure[+T, +E](error: E)

Represents a failed result containing an error of type E.

Value parameters

error

the error value

Attributes

Members list

Value members

Inherited methods

def flatMap[U, F](f: T => Result[U, F]): Result[U, E | F]

Applies a function that returns a Result to the success value, flattening the result. This is useful for chaining operations that might fail.

Applies a function that returns a Result to the success value, flattening the result. This is useful for chaining operations that might fail.

Type parameters

F

the error type of the returned Result

U

the success type of the returned Result

Value parameters

f

the function to apply to the success value

Attributes

Returns

the result of applying f if this is a Success, or the same Failure if this is a Failure

Inherited from:
Result
def getOrElse[U >: T](default: U): U

Returns the success value if this is a Success, otherwise returns the default value.

Returns the success value if this is a Success, otherwise returns the default value.

Type parameters

U

the type of the default value (must be a supertype of T)

Value parameters

default

the value to return if this is a Failure

Attributes

Returns

the success value or the default value

Inherited from:
Result
def isFailure: Boolean

Returns true if this Result is a Failure, false otherwise.

Returns true if this Result is a Failure, false otherwise.

Attributes

Returns

true if Failure, false if Success

Inherited from:
Result
def isSuccess: Boolean

Returns true if this Result is a Success, false otherwise.

Returns true if this Result is a Success, false otherwise.

Attributes

Returns

true if Success, false if Failure

Inherited from:
Result
def map[U](f: T => U): Result[U, E]

Transforms the success value using the provided function, leaving failures unchanged.

Transforms the success value using the provided function, leaving failures unchanged.

Type parameters

U

the type of the transformed value

Value parameters

f

the function to apply to the success value

Attributes

Returns

a new Result with the transformed value if this is a Success, or the same Failure if this is a Failure

Inherited from:
Result
def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product