From 05ed4e755733ebce92f27806567b7275b775879d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Sun, 26 Feb 2017 02:02:33 +0100 Subject: [PATCH] Error_monad: allow binary serialization of error. --- src/utils/error_monad.ml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/utils/error_monad.ml b/src/utils/error_monad.ml index 7419790d3..46dd1d00f 100644 --- a/src/utils/error_monad.ml +++ b/src/utils/error_monad.ml @@ -104,7 +104,15 @@ module Make() = struct List.map (fun (Error_kind { encoding_case }) -> encoding_case ) !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 ; encoding | Some encoding -> encoding