e.scala

package e.scala

Members list

Packages

package e.scala.codec

Type members

Classlikes

final case class E(code: Option[Int], name: Option[String], message: Option[String], causes: List[E], data: Map[String, String], time: Option[Long])

A generic and immutable error, containing helpful information

A generic and immutable error, containing helpful information

Value parameters

causes

Underlying cause(s) of this error, if any

code

A numeric code identifying this error

data

Arbitrary data related to this error as a key-value map

message

A message about this error, usually human-readable

name

A name identifying this error, usually enum-like

time

Time when this error occurred as milliseconds, see java.lang.System#currentTimeMillis

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object E

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
E.type
final case class EException(e: E) extends RuntimeException

A RuntimeException wrapping E to be used where errors are represented as E but an Exception is needed

A RuntimeException wrapping E to be used where errors are represented as E but an Exception is needed

Value parameters

e

An E

Attributes

See also

_root_.e.scala.E

java.lang.RuntimeException

Supertypes
trait Product
trait Equals
class RuntimeException
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
sealed trait EOr[+A]

A container that can either be a Failure containing an E or Success containing a value, semantically a combination of Either and Try but specialized for E

A container that can either be a Failure containing an E or Success containing a value, semantically a combination of Either and Try but specialized for E

Type parameters

A

Type of the value this EOr can contain

Attributes

See also

_root_.scala.util.Either

_root_.scala.util.Try

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Failure
class Success[A]
Self type
EOr[A]
object EOr

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
EOr.type

Types

infix type or[+_ <: E, +A] = EOr[A]

Type alias for EOr, allowing a more pleasing syntax as following:

Type alias for EOr, allowing a more pleasing syntax as following:

 E or String // instead of EOr[String]

Type parameters

A

Type of the value EOr can contain

Attributes

See also

Extensions

Extensions

extension [A](a: => A)
inline def catching(ifFailure: Throwable => E): EOr[A]

Constructs an EOr from evaluating this value and by converting caught Exception using given function

Constructs an EOr from evaluating this value and by converting caught Exception using given function

Value parameters

ifFailure

An E conversion function in case evaluating this value throws

Attributes

Returns

An EOr containing either evaluated value or an E computed by given function

inline def toEOr: EOr[A]

Converts this value to a successful EOr[A]

Converts this value to a successful EOr[A]

Attributes

Returns

An EOr[A] containing this value

See also
extension [L, R](either: Either[L, R])
inline def toEOr(ifLeft: L => E): EOr[R]

Constructs an EOr from this _root_.scala.util.Either

Constructs an EOr from this _root_.scala.util.Either

Value parameters

ifLeft

An E conversion function in case this Either is Left

Attributes

Returns

An EOr containing either Right value in this Either or an E computed by given function

extension [A](option: Option[A])
inline def toEOr(ifNone: => E): EOr[A]

Constructs an EOr from this _root_.scala.Option

Constructs an EOr from this _root_.scala.Option

Value parameters

ifNone

An E to use in case this Option is None

Attributes

Returns

An EOr containing either value in this Option or given E

extension [A](t: Try[A])
inline def toEOr(ifFailure: Throwable => E): EOr[A]

Constructs an EOr from this _root_.scala.util.Try

Constructs an EOr from this _root_.scala.util.Try

Value parameters

ifFailure

An E conversion function in case this Try is Failure

Attributes

Returns

An EOr containing either value in this Try or an E computed by given function

extension (throwable: Throwable)
inline def toE(f: Throwable => E): E

Constructs an E from this _root_.scala.Throwable

Constructs an E from this _root_.scala.Throwable

Value parameters

f

A mapping function

Attributes

Returns

A new E containing message of this Throwable