Tezos_dal_node_lib.Errors
type Tezos_base.TzPervasives.error +=
| Decoding_failed of Tezos_dal_node_services.Types.Store.kind
| Profile_incompatibility
| Invalid_slot_index of {
}
| Cryptobox_initialisation_failed of string
| Not_enough_history of {
}
| Not_enough_l1_history of {
}
| Amplificator_initialization_failed
Extension of the open type error
with the errors that could be raised by the DAL node.
The errors below are used to extend tzresult/tztrace monad/errors with Some specific errors on which we'd like to match in the DAL node's code.
We would like to match `Not_found
as we would want to return 404 HTTP code to clients.
We will use `Other
to wrap other tztrace
errors in the new polymorphic-variants based monad.
val not_found : [> not_found ]
not_found
is an alias for `Not_found
.
val decoding_failed :
Tezos_dal_node_services.Types.Store.kind ->
Tezos_base.TzPervasives.tztrace ->
[> other ]
decoding_failed kind trace
produces the error trace Decoding_failed kind :: trace
and wraps it with `Other
.
val other : Tezos_base.TzPervasives.tztrace -> [> other ]
other l
wraps the give tztrace l
in `Other
.
val other_result :
'a Tezos_base.TzPervasives.tzresult ->
('a, [> other ]) Stdlib.result
other_result r
casts the given value r
from the 'a tzresult
monad into ('a, [> other_error]) result
.
val other_lwt_result :
'a Tezos_base.TzPervasives.tzresult Lwt.t ->
('a, [> other ]) Stdlib.result Lwt.t
other_lwt_result r
casts the given value r
from the 'a tzresult Lwt.t
monad into ('a, [> other]) result Lwt.t
.
val to_option_tzresult :
('a, [< not_found | other ]) Stdlib.result Lwt.t ->
'a option Tezos_base.TzPervasives.tzresult Lwt.t
to_option_tzresult v
transforms the given value v
to another value in the regular 'a option tzresult Lwt.t
monad.
Asuming the Lwt monad v
successfully resolves, then:
Ok w
, the function returns an Lwt monad whose payload is Ok (Some w)
.Error `Not_found
, the function returns an Lwt monad whose payload is Ok (None)
so that Tezos_rpc_http
returns 404 HTTP code.Error `Other u
. In this case, the function returns an Lwt monad whose payload is Error u
.val to_tzresult :
('a, [< other ]) Stdlib.result Lwt.t ->
'a Tezos_base.TzPervasives.tzresult Lwt.t
to_tzresult v
is quite similar to to_option_tzresult
. Except that the `Not_found
case cannot happen, in which case the use of option
for the non-failing case is not needed.