p

busymachines.core

exceptions

package exceptions

Since

31 Jul 2017

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. exceptions
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. abstract class ConflictFailure extends FailureBase with Conflict

    See scaladoc at top of file for general picture.

    See scaladoc at top of file for general picture.

    See SemanticFailures.Conflict for intended use.

    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  2. abstract class DeniedFailure extends FailureBase with Denied

    See scaladoc at top of file for general picture.

    See scaladoc at top of file for general picture.

    See SemanticFailures.Denied for intended use.

    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  3. abstract class Error extends Exception with FailureMessage with ErrorMessage
    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  4. trait ErrorMessage extends FailureMessage

    THERE'S EVERYTHING WRONG WITH ERRORS!

    THERE'S EVERYTHING WRONG WITH ERRORS!

    The more meaningful design decisions are the ones made in failures.scala file detailing the definitions of various busymachines.core.exceptions.FailureMessage

    Since the types here are a minority, the design here emulates the one from the other more commonly used file.

    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  5. abstract class FailureBase extends Exception with FailureMessage

    Should be extended sparingly outside of this file.

    Should be extended sparingly outside of this file.

    Most likely you need to extend one of the other cases.

    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  6. trait FailureID extends AnyRef

    THERE'S NOTHING WRONG WITH FAILURE!

    THERE'S NOTHING WRONG WITH FAILURE!

    There, now that that got your attention, let me elaborate on the intention of these types.

    Basically, they are a semantically richer way of expressing common failures when developing backend-servers.

    Furthermore, these exceptions being part of the core of the application —by reading this file— you have not gauged their full potentiality, yet. The intention is to give richer interpretations to these "common failures" in other busymachines-commons modules than could be done to the likes of Throwable.

    The reason why there is a trait FailureMessage, and some types that extend Exception is that the potentiality of these types can be achieved either through a monad stack approach to building applications, or to a more vanilla scala approach, respectively.

    There is a hierarchy of FailureMessage representing one single failure, in richer details.

    FailureMessages represents a container of multiple FailureMessages. The intended use of the FailureMessages.id is to signal the general "context" within which the specific FailureMessages.messages where gathered. While each specific FailureMessage contains information about what went wrong.

    There are the following semantically meaningful exceptions (with their plural counterparts elided) that you ought to be using: - NotFoundFailure - SemanticFailures.NotFound - UnauthorizedFailure - SemanticFailures.Unauthorized - ForbiddenFailure - SemanticFailures.Forbidden - DeniedFailure - SemanticFailures.Denied - InvalidInputFailure - SemanticFailures.InvalidInput - ConflictFailure - SemanticFailures.Conflict

    Each described in the SemanticFailures docs.

    These definitions are also quite flexible enough to allow multiple styles of active development:

    1) The quick and dirty, "better than RuntimeException" style. Basically, you just wind up using the default constructors on the companion object, or the companion object itself

    //I know I am in the middle of my domain problem, and I know that here
    //I can fail because "I did not find something", so I just quickly use:
    
    option.getOrElse(throw NotFoundFailure)
    option.getOrElse(throw NotFoundFailure("this specific option, instead of generic"))

    This style should be kept just that, "quick and dirty". After the first iteration of the implementation these failures should be replaced by the ones in style 2)

    2) The long term style. Where you subclass NotFoundFailure into a more meaningful exception specific to your problem domain, supply some context via the parameters, and assign it an (preferably) application-wide unique FailureID.

    object RevolutionaryDomainFailures {
      case object CannotBeDone extends FailureID { val name = "rd_001" }
      //... and many others
    }
    
    case class SolutionNotFoundFailure(problem: String) extends NotFoundFailure(
      "Cannot find solution to problem:" + problem
    ) {
      override def id: FailureID = RevolutionaryDomainFailures.CannotBeDone
    
      override def parameters: Parameters = Map(
        "problem" -> problem
      )
    }
    
    object Main {
      //...
      solutionToPVSNP.getOrElse(throw SolutionNotFoundFailure("P vs. NP"))
      solutionToHaltingProblem.getOrElse(throw SolutionNotFoundFailure("Halting Problem"))
      //how refined you want your failures, that's up to you.
    }
    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

    Since

    31 Jul 2017

  7. trait FailureMessage extends AnyRef
    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  8. trait FailureMessages extends FailureMessage

    FailureMessage counterpart, but for situations when multiple such messages can occur.

    FailureMessage counterpart, but for situations when multiple such messages can occur.

    FailureMessages#id, and FailureMessages#message should be used to convey the general context withing which FailureMessages#messages where gathered.

    Guaranteed to have non-empty FailureMessages

    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  9. abstract class Failures extends Exception with FailureMessages

    Similar to FailureBase but encapsulate multiple causes.

    Similar to FailureBase but encapsulate multiple causes.

    Primarily used as containers for validation failures.

    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  10. abstract class ForbiddenFailure extends FailureBase with Forbidden

    See scaladoc at top of file for general picture.

    See scaladoc at top of file for general picture.

    See SemanticFailures.Forbidden for intended use.

    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  11. abstract class InconsistentStateError extends Error with InconsistentState

    See SemanticErrors.InconsistentState for intended use.

    See SemanticErrors.InconsistentState for intended use.

    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  12. abstract class InvalidInputFailure extends FailureBase with InvalidInput

    See scaladoc at top of file for general picture.

    See scaladoc at top of file for general picture.

    See SemanticFailures.InvalidInput for intended use.

    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  13. abstract class NotFoundFailure extends FailureBase with NotFound

    See scaladoc at top of file for general picture.

    See scaladoc at top of file for general picture.

    See SemanticFailures.NotFound for intended use.

    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  14. abstract class UnauthorizedFailure extends FailureBase with Unauthorized

    See scaladoc at top of file for general picture.

    See scaladoc at top of file for general picture.

    See SemanticFailures.Unauthorized for intended use.

    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

Value Members

  1. implicit final def failureMessageParamValueSeqOfStringWrapper(ses: Seq[String]): ParamValue
  2. implicit final def failureMessageParamValueStringWrapper(s: String): ParamValue

Deprecated Value Members

  1. object ConflictFailure extends ConflictFailure
    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  2. object DeniedFailure extends DeniedFailure
    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  3. object Error extends Error
    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  4. object FailureBase extends Serializable
    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  5. object FailureID
    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  6. object FailureMessage
    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  7. object FailureMessages
    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  8. object Failures extends Serializable
    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  9. object ForbiddenFailure extends ForbiddenFailure
    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  10. object InconsistentStateError extends InconsistentStateError
    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  11. object InvalidInputFailure extends InvalidInputFailure
    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  12. object NotFoundFailure extends NotFoundFailure
    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  13. object SemanticErrors
    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  14. object SemanticFailures

    Marker traits, so that both the FailureBase and Failures can be marked with the same semantic meaning

    Marker traits, so that both the FailureBase and Failures can be marked with the same semantic meaning

    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

  15. object UnauthorizedFailure extends UnauthorizedFailure
    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.0-RC8) Use the types from busymachines.core

Inherited from AnyRef

Inherited from Any

Ungrouped