Scala Either type: How to get the value out of an Either
Briefly

One solution is to use a match expression: val b: Int | Throwable = a match case Right(value) => value case Left(error) => error
Depending on your situation, getOrElse can be another good solution: val b = eLeft.getOrElse(0) // 0
Another usual approach is to just write your code like normal, only really worrying about the success case, and the failure case eventually takes care of itself.
Read at Alvinalexander
[
add
]
[
|
|
]