RPC: add missing error registration

This commit is contained in:
Benjamin Canou 2018-06-05 16:55:28 +02:00
parent 83dae71883
commit 23e1486564
3 changed files with 11 additions and 11 deletions

View File

@ -166,7 +166,7 @@ let build_raw_rpc_directory
register1 S.Context.read begin fun block path q () ->
let depth = Option.unopt ~default:max_int q#depth in
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 ->
Context.mem context path >>= fun mem ->
Context.dir_mem context path >>= fun dir_mem ->

View File

@ -126,19 +126,19 @@ let raw_context_encoding =
])
type error +=
| Invalid_depth_arg of (string list * int)
| Invalid_depth_arg of int
let () =
register_error_kind
`Permanent
~id:"raw_context.missing_key"
~title:"...FIXME..."
~description:"...FIXME..."
~pp:(fun ppf path ->
Format.fprintf ppf "Missing key: %s" (String.concat "/" path))
Data_encoding.(obj1 (req "path" (list string)))
(function Missing_key path -> Some path | _ -> None)
(fun path -> Missing_key path)
~id:"raw_context.invalid_depth"
~title:"Invalid depth argument"
~description:"The raw context extraction depth argument must be positive."
~pp:(fun ppf depth ->
Format.fprintf ppf "Extraction depth %d is invalid" depth)
Data_encoding.(obj1 (req "depth" int31))
(function Invalid_depth_arg depth -> Some depth | _ -> None)
(fun depth -> Invalid_depth_arg depth)
module type PROTO = sig
val hash: Protocol_hash.t

View File

@ -46,7 +46,7 @@ type raw_context =
val pp_raw_context: Format.formatter -> raw_context -> unit
type error +=
| Invalid_depth_arg of (string list * int)
| Invalid_depth_arg of int
module type PROTO = sig
val hash: Protocol_hash.t