- Overview
- Tutorials
- Getting started
- Get started with Canton and the JSON Ledger API
- Get Started with Canton, the JSON Ledger API, and TypeScript
- Get started with Canton Network App Dev Quickstart
- Get started with smart contract development
- Basic contracts
- Test templates using Daml scripts
- Build the Daml Archive (.dar) file
- Data types
- Transform contracts using choices
- Add constraints to a contract
- Parties and authority
- Compose choices
- Handle exceptions
- Work with dependencies
- Functional programming 101
- The Daml standard library
- Test Daml contracts
- Next steps
- Application development
- Getting started
- Development how-tos
- Component how-tos
- Explanations
- References
- Application development
- Smart contract development
- Daml language cheat sheet
- Daml language reference
- Daml standard library
- DA.Action.State.Class
- DA.Action.State
- DA.Action
- DA.Assert
- DA.Bifunctor
- DA.Crypto.Text
- DA.Date
- DA.Either
- DA.Exception
- DA.Fail
- DA.Foldable
- DA.Functor
- DA.Internal.Interface.AnyView.Types
- DA.Internal.Interface.AnyView
- DA.List.BuiltinOrder
- DA.List.Total
- DA.List
- DA.Logic
- DA.Map
- DA.Math
- DA.Monoid
- DA.NonEmpty.Types
- DA.NonEmpty
- DA.Numeric
- DA.Optional
- DA.Record
- DA.Semigroup
- DA.Set
- DA.Stack
- DA.Text
- DA.TextMap
- DA.Time
- DA.Traversable
- DA.Tuple
- DA.Validation
- GHC.Show.Text
- GHC.Tuple.Check
- Prelude
- Smart contract upgrading reference
- Glossary of concepts
DA.Fail¶
Fail, for FailureStatus
Typeclasses¶
class Action m => ActionFailWithStatus m where
- failWithStatus
: FailureStatus -> m a
Fail with a failure status
instance ActionFailWithStatus Update
Data Types¶
data FailureCategory
The category of the failure, which determines the status code and log level of the failure. Maps 1-1 to the Canton error categories documented here: https://docs.daml.com/canton/reference/error_codes.html#error-categories-inventory
If you are more familiar with gRPC error codes, you can use the synonyms referenced in the comments.
InvalidIndependentOfSystemState
Use this to report errors that are independent of the current state of the ledger, and should thus not be retried.
Corresponds to the gRPC status code
INVALID_ARGUMENT
.See https://docs.daml.com/canton/reference/error_codes.html#invalidindependentofsystemstate for more information.
InvalidGivenCurrentSystemStateOther
Use this to report errors that are due to the current state of the ledger, but might disappear if the ledger state changes. Clients should retry these requests after reading updated state from the ledger.
Corresponds to the gRPC status code
FAILED_PRECONDITION
.See https://docs.daml.com/canton/reference/error_codes.html#invalidgivencurrentsystemstateother for more information.
instance Eq FailureCategory
instance Ord FailureCategory
instance Show FailureCategory
data FailureStatus
Field
Type
Description
errorId
Unambiguous identifier of the error. SHOULD be prefixed with the DNS name identifying the app provider or the API standard defining the error. For example,
splice.lfdecentralizedtrust.org/insufficient-funds
could be used for reporting an out of funds error in the context of the CN token standards.category
Category of the failure, which determines how clients are expected to handle the error.
message
Developer-facing error message, which should be in English.
meta
Machine-readable metadata about the error in a key-value format. Use this to provide extra context to clients for errors. SHOULD be less than < 512 characters as it MAY be truncated otherwise.
instance Eq FailureStatus
instance Ord FailureStatus
instance Show FailureStatus
Functions¶
- invalidArgument
-
Alternative name for
InvalidIndependentOfSystemState
.
- failedPrecondition
-
Alternative name for
InvalidGivenCurrentSystemStateOther
.
- failWithStatusPure
: FailureStatus -> a
Fail with a failure status in a pure context