busymachines.pureharm.anomaly

Type members

Classlikes

abstract class Anomalies(val id: AnomalyID, val message: String, val firstAnomaly: Anomaly, val restOfAnomalies: Seq[Anomaly], val causedBy: Option[Throwable]) extends AnomalyLike with AnomaliesBase with Product with Serializable
Companion
object
object Anomalies
Companion
class
trait AnomaliesBase extends AnomalyBase with Product with Serializable
Since

11 Jun 2019

abstract class Anomaly(val message: String, val causedBy: Option[Throwable]) extends AnomalyLike with AnomalyBase with Product with Serializable

You should express your business logic expected ways of failure using this trait.

You should express your business logic expected ways of failure using this trait.

Companion
object
object Anomaly extends AnomalyConstructors[Anomaly]
Companion
class
trait AnomalyBase extends Product with Serializable
trait AnomalyID extends Product with Serializable with Equals

Some suggested naming conventions are put here so that they're easily accessible. These can also be found in the scaladoc of busymachines.pureharm.anomaly.MeaningfulAnomalies

Some suggested naming conventions are put here so that they're easily accessible. These can also be found in the scaladoc of busymachines.pureharm.anomaly.MeaningfulAnomalies

Companion
object
object AnomalyID
Companion
class
abstract class AnomalyLike(val message: String, val causedBy: Option[Throwable]) extends Throwable with AnomalyBase
Since

11 Jun 2019

abstract class Catastrophe(val message: String, val causedBy: Option[Throwable]) extends AnomalyLike with CatastropheBase with Product with Serializable

Use as base class to signal irrecoverable domain specific errors.

Use as base class to signal irrecoverable domain specific errors.

Companion
object
object Catastrophe extends CatastropheConstructors[Catastrophe]
Companion
class
trait CatastropheBase extends AnomalyBase with Product with Serializable
abstract class ConflictAnomaly(val message: String, val causedBy: Option[Throwable]) extends Anomaly with Conflict with Product with Serializable
Companion
object
object ConflictAnomaly extends ConflictAnomaly with SingletonAnomalyProduct with AnomalyConstructors[ConflictAnomaly]
Companion
class
abstract class DeniedAnomaly(val message: String, val causedBy: Option[Throwable]) extends Anomaly with Denied with Product with Serializable
Companion
object
object DeniedAnomaly extends DeniedAnomaly with SingletonAnomalyProduct with AnomalyConstructors[DeniedAnomaly]
Companion
class
abstract class ForbiddenAnomaly(val message: String, val causedBy: Option[Throwable]) extends Anomaly with Forbidden with Product with Serializable
Companion
object
object ForbiddenAnomaly extends ForbiddenAnomaly with SingletonAnomalyProduct with AnomalyConstructors[ForbiddenAnomaly]
Companion
class
abstract class InconsistentStateCatastrophe(val message: String, val causedBy: Option[Throwable]) extends Catastrophe with Product with Serializable
Companion
object
object InconsistentStateCatastrophe extends CatastropheConstructors[InconsistentStateCatastrophe]
Companion
class
abstract class InvalidInputAnomaly(val message: String, val causedBy: Option[Throwable]) extends Anomaly with InvalidInput with Product with Serializable
Companion
object
object InvalidInputAnomaly extends InvalidInputAnomaly with SingletonAnomalyProduct with AnomalyConstructors[InvalidInputAnomaly]
Companion
class

Some suggested naming conventions are put here so that they're easily accessible. These can also be found in the scaladoc of busymachines.pureharm.anomaly.AnomalyID

Some suggested naming conventions are put here so that they're easily accessible. These can also be found in the scaladoc of busymachines.pureharm.anomaly.AnomalyID

  • busymachines.pureharm.anomaly.MeaningfulAnomalies.NotFound

    • range: 000-099; e.g. pone_001, ptwo_076, pthree_099
  • busymachines.pureharm.anomaly.MeaningfulAnomalies.UnauthorizedMsg

    • range: 100-199; e.g. pone_100, ptwo_176, pthree_199
  • busymachines.pureharm.anomaly.MeaningfulAnomalies.ForbiddenMsg

    • range: 200-299; e.g. pone_200, ptwo_276, pthree_299
  • busymachines.pureharm.anomaly.MeaningfulAnomalies.DeniedMsg

    • range: 300-399; e.g. pone_300, ptwo_376, pthree_399
  • busymachines.pureharm.anomaly.MeaningfulAnomalies.InvalidInput

    • range: 400-499; e.g. pone_400, ptwo_476, pthree_499
abstract class NotFoundAnomaly(val message: String, val causedBy: Option[Throwable]) extends Anomaly with NotFound with Product with Serializable
Companion
object
object NotFoundAnomaly extends NotFoundAnomaly with SingletonAnomalyProduct with AnomalyConstructors[NotFoundAnomaly]
Companion
class
abstract class NotImplementedCatastrophe(val message: String, val causedBy: Option[Throwable]) extends Catastrophe with Product with Serializable
Companion
object
object NotImplementedCatastrophe extends CatastropheConstructors[NotImplementedCatastrophe]
Companion
class

Mix this into your app's "core" package to get all these nice little anomalies.

Mix this into your app's "core" package to get all these nice little anomalies.

Since

10 Jun 2019

final case class SeqStringWrapper extends StringOrSeqString
sealed trait StringOrSeqString extends Product with Serializable

This is a hack until dotty (scala 3.0) comes along with union types. Until then, boiler plate freedom is given by the implicit conversions found in the package object

This is a hack until dotty (scala 3.0) comes along with union types. Until then, boiler plate freedom is given by the implicit conversions found in the package object

final case class StringWrapper extends StringOrSeqString
abstract class UnauthorizedAnomaly(val message: String, val causedBy: Option[Throwable]) extends Anomaly with Unauthorized with Product with Serializable
Companion
object
object UnauthorizedAnomaly extends UnauthorizedAnomaly with SingletonAnomalyProduct with AnomalyConstructors[UnauthorizedAnomaly]
Companion
class
abstract class UnhandledCatastrophe(val message: String, cause: Throwable, params: Parameters) extends Catastrophe with Product with Serializable
Companion
object
Companion
class

Implicits

Inherited implicits

final implicit def anomalyParamValueSeqOfStringWrapper(ses: Seq[String]): Parameter
final implicit def anomalyParamValueStringWrapper(s: String): Parameter
implicit val pureharmThrowableShow: Show[Throwable]