diff --git a/src/lib_rpc/RPC_context.ml b/src/lib_rpc/RPC_context.ml index 1b469fa98..71ad995df 100644 --- a/src/lib_rpc/RPC_context.ml +++ b/src/lib_rpc/RPC_context.ml @@ -148,3 +148,24 @@ let make_streamed_call s (ctxt : #streamed) p q i = and on_close () = push None in ctxt#call_streamed_service s ~on_chunk ~on_close p q i >>=? fun close -> return (stream, close) + +let () = + let open Data_encoding in + let uri_encoding = + conv + Uri.to_string + Uri.of_string + string in + register_error_kind + `Branch + ~id:"RPC_context.Not_found" + ~title:"RPC lookup failed" + ~description:"RPC lookup failed. No RPC exists at the URL or the RPC tried to access non-existant data." + (obj2 + (req "method" RPC_service.meth_encoding) + (req "uri" uri_encoding)) + ~pp:(fun ppf (_meth, _uri) -> + Format.fprintf ppf "Did not find service") + (function Not_found { meth ; uri } -> Some (meth, uri) + | _ -> None) + (fun (meth, uri) -> Not_found { meth ; uri })