DA.Exception
Exception handling in Daml. DEPRECATED: UsefailWithStatus 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.9All deprecations (2)
All deprecations (2)
- Exceptions are deprecated, prefer
failWithStatus, and avoid using catch. - Use
-Wno-deprecated-exceptionsto 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.
Constructors:
ArithmeticError
Text
data AssertionFailed
Exception raised by assert functions in DA.Assert
Constructors:
AssertionFailed
Text
data GeneralError
Exception raised by error.
Constructors:
GeneralError
Text
data PreconditionFailed
Exception raised when a contract is invalid, i.e. fails the ensure clause.
Constructors:
PreconditionFailed
Text
Typeclasses
class HasThrow e
Part of the Exception constraint.
Methods:
throwPure:e->tThrow exception in a pure context.
- instance
HasThrowArithmeticError - instance
HasThrowAssertionFailed - instance
HasThrowGeneralError - instance
HasThrowPreconditionFailed
class HasMessage e
Part of the Exception constraint.
Methods:
message:e->TextGet the error message associated with an exception.
- instance
HasMessageAnyException - instance
HasMessageArithmeticError - instance
HasMessageAssertionFailed - instance
HasMessageGeneralError - instance
HasMessagePreconditionFailed
class HasToAnyException e
Part of the Exception constraint.
Methods:
toAnyException:e->AnyExceptionConvert an exception type to AnyException.
- instance
HasToAnyExceptionAnyException - instance
HasToAnyExceptionArithmeticError - instance
HasToAnyExceptionAssertionFailed - instance
HasToAnyExceptionGeneralError - instance
HasToAnyExceptionPreconditionFailed
class HasFromAnyException e
Part of the Exception constraint.
Methods:
fromAnyException:AnyException->OptionaleConvert an AnyException back to the underlying exception type, if possible.
- instance
HasFromAnyExceptionAnyException - instance
HasFromAnyExceptionArithmeticError - instance
HasFromAnyExceptionAssertionFailed - instance
HasFromAnyExceptionGeneralError - instance
HasFromAnyExceptionPreconditionFailed
class Action m => ActionThrow m
Action type in which throw is supported.
Methods:
throw:Exceptione=>e->mt
- instance
ActionThrowUpdate
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: (() ->mt) -> (AnyException->Optional(mt)) ->mtHandle an exception. Use thetry ... catch ...syntax instead of calling this method directly.
- instance
ActionCatchUpdate
Orphan Typeclass Instances
-
instance
GetFieldmessageGeneralErrorText -
instance
SetFieldmessageGeneralErrorText -
instance
GetFieldmessageArithmeticErrorText -
instance
SetFieldmessageArithmeticErrorText -
instance
GetFieldmessagePreconditionFailedText -
instance
SetFieldmessagePreconditionFailedText -
instance
GetFieldmessageAssertionFailedText -
instance
SetFieldmessageAssertionFailedText