RPC_service: register Not_found error
This commit is contained in:
parent
632144b689
commit
4c03952e43
@ -148,3 +148,24 @@ let make_streamed_call s (ctxt : #streamed) p q i =
|
|||||||
and on_close () = push None in
|
and on_close () = push None in
|
||||||
ctxt#call_streamed_service s ~on_chunk ~on_close p q i >>=? fun close ->
|
ctxt#call_streamed_service s ~on_chunk ~on_close p q i >>=? fun close ->
|
||||||
return (stream, 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 })
|
||||||
|
Loading…
Reference in New Issue
Block a user