RPC: add missing error registration
This commit is contained in:
parent
83dae71883
commit
23e1486564
@ -166,7 +166,7 @@ let build_raw_rpc_directory
|
|||||||
register1 S.Context.read begin fun block path q () ->
|
register1 S.Context.read begin fun block path q () ->
|
||||||
let depth = Option.unopt ~default:max_int q#depth in
|
let depth = Option.unopt ~default:max_int q#depth in
|
||||||
fail_unless (depth >= 0)
|
fail_unless (depth >= 0)
|
||||||
(Tezos_shell_services.Block_services.Invalid_depth_arg (path, depth)) >>=? fun () ->
|
(Tezos_shell_services.Block_services.Invalid_depth_arg depth) >>=? fun () ->
|
||||||
State.Block.context block >>= fun context ->
|
State.Block.context block >>= fun context ->
|
||||||
Context.mem context path >>= fun mem ->
|
Context.mem context path >>= fun mem ->
|
||||||
Context.dir_mem context path >>= fun dir_mem ->
|
Context.dir_mem context path >>= fun dir_mem ->
|
||||||
|
@ -126,19 +126,19 @@ let raw_context_encoding =
|
|||||||
])
|
])
|
||||||
|
|
||||||
type error +=
|
type error +=
|
||||||
| Invalid_depth_arg of (string list * int)
|
| Invalid_depth_arg of int
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
register_error_kind
|
register_error_kind
|
||||||
`Permanent
|
`Permanent
|
||||||
~id:"raw_context.missing_key"
|
~id:"raw_context.invalid_depth"
|
||||||
~title:"...FIXME..."
|
~title:"Invalid depth argument"
|
||||||
~description:"...FIXME..."
|
~description:"The raw context extraction depth argument must be positive."
|
||||||
~pp:(fun ppf path ->
|
~pp:(fun ppf depth ->
|
||||||
Format.fprintf ppf "Missing key: %s" (String.concat "/" path))
|
Format.fprintf ppf "Extraction depth %d is invalid" depth)
|
||||||
Data_encoding.(obj1 (req "path" (list string)))
|
Data_encoding.(obj1 (req "depth" int31))
|
||||||
(function Missing_key path -> Some path | _ -> None)
|
(function Invalid_depth_arg depth -> Some depth | _ -> None)
|
||||||
(fun path -> Missing_key path)
|
(fun depth -> Invalid_depth_arg depth)
|
||||||
|
|
||||||
module type PROTO = sig
|
module type PROTO = sig
|
||||||
val hash: Protocol_hash.t
|
val hash: Protocol_hash.t
|
||||||
|
@ -46,7 +46,7 @@ type raw_context =
|
|||||||
val pp_raw_context: Format.formatter -> raw_context -> unit
|
val pp_raw_context: Format.formatter -> raw_context -> unit
|
||||||
|
|
||||||
type error +=
|
type error +=
|
||||||
| Invalid_depth_arg of (string list * int)
|
| Invalid_depth_arg of int
|
||||||
|
|
||||||
module type PROTO = sig
|
module type PROTO = sig
|
||||||
val hash: Protocol_hash.t
|
val hash: Protocol_hash.t
|
||||||
|
Loading…
Reference in New Issue
Block a user