Skip to main content

DA.Exception

Exception handling in Daml. DEPRECATED: Use failWithStatus and FailureStatus over Daml Exceptions

Module Snapshot

Lifecycle

Deprecated.

Notices

Status: active Introduced in: 3.4.9 Removed in: - Warnings: 0 Deprecations: 2 Deprecated since: 3.4.9
Exceptions are deprecated, prefer failWithStatus, and avoid using catch.
  • Exceptions are deprecated, prefer failWithStatus, and avoid using catch.
  • Use -Wno-deprecated-exceptions to disable this warning.

Data Types

type Exception e

= (HasThrow e, HasMessage e, HasToAnyException e, HasFromAnyException e) Exception typeclass. This should not be implemented directly, instead, use the exception syntax.

data ArithmeticError

Exception raised by an arithmetic operation, such as divide-by-zero or overflow.
Deprecated: Exceptions are deprecated, prefer failWithStatus, and avoid using catch.
Deprecated: Use -Wno-deprecated-exceptions to disable this warning.
Constructors:
  • ArithmeticError
Text

data AssertionFailed

Exception raised by assert functions in DA.Assert
Deprecated: Exceptions are deprecated, prefer failWithStatus, and avoid using catch.
Deprecated: Use -Wno-deprecated-exceptions to disable this warning.
Constructors:
  • AssertionFailed
Text

data GeneralError

Exception raised by error.
Deprecated: Exceptions are deprecated, prefer failWithStatus, and avoid using catch.
Deprecated: Use -Wno-deprecated-exceptions to disable this warning.
Constructors:
  • GeneralError
Text

data PreconditionFailed

Exception raised when a contract is invalid, i.e. fails the ensure clause.
Deprecated: Exceptions are deprecated, prefer failWithStatus, and avoid using catch.
Deprecated: Use -Wno-deprecated-exceptions to disable this warning.
Constructors:
  • PreconditionFailed
Text

Typeclasses

class HasThrow e

Part of the Exception constraint. Methods:
  • throwPure : e -> t Throw exception in a pure context.
Instances:

class HasMessage e

Part of the Exception constraint. Methods:
  • message : e -> Text Get the error message associated with an exception.
Instances:

class HasToAnyException e

Part of the Exception constraint. Methods:
  • toAnyException : e -> AnyException Convert an exception type to AnyException.
Instances:

class HasFromAnyException e

Part of the Exception constraint. Methods:
  • fromAnyException : AnyException -> Optional e Convert an AnyException back to the underlying exception type, if possible.
Instances:

class Action m => ActionThrow m

Action type in which throw is supported. Methods: Instances:

class ActionThrow m => ActionCatch m

Action type in which try ... catch ... is supported. DEPRECATED: Avoid the use of catch in daml code, prefer error handling on client, and throwing using failWithStatus Methods:
  • _tryCatch : (() -> m t) -> (AnyException -> Optional (m t)) -> m t Handle an exception. Use the try ... catch ... syntax instead of calling this method directly.
Instances:

Orphan Typeclass Instances