Error_monad: allow binary serialization of error.

This commit is contained in:
Grégoire Henry 2017-02-26 02:02:33 +01:00
parent b461b6c0c6
commit 05ed4e7557

View File

@ -104,7 +104,15 @@ module Make() = struct
List.map List.map
(fun (Error_kind { encoding_case }) -> encoding_case ) (fun (Error_kind { encoding_case }) -> encoding_case )
!error_kinds in !error_kinds in
let encoding = Data_encoding.union cases in let json_encoding = Data_encoding.union cases in
let encoding =
Data_encoding.splitted
~json:json_encoding
~binary:
(Data_encoding.conv
(Data_encoding.Json.construct json_encoding)
(Data_encoding.Json.destruct json_encoding)
Data_encoding.json) in
error_encoding_cache := Some encoding ; error_encoding_cache := Some encoding ;
encoding encoding
| Some encoding -> encoding | Some encoding -> encoding