From 9b9c3a1beec15b04c20cb964d640ae75be255057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Thu, 19 Jul 2018 01:28:08 +0200 Subject: [PATCH] Proto: avoid conflict between client errors --- src/proto_alpha/lib_client/michelson_v1_macros.ml | 1 + src/proto_alpha/lib_client/proto_alpha.ml | 9 +++++++++ src/proto_alpha/lib_protocol/test/helpers/proto_alpha.ml | 8 ++++++++ 3 files changed, 18 insertions(+) diff --git a/src/proto_alpha/lib_client/michelson_v1_macros.ml b/src/proto_alpha/lib_client/michelson_v1_macros.ml index 76ec47173..a10a8b112 100644 --- a/src/proto_alpha/lib_client/michelson_v1_macros.ml +++ b/src/proto_alpha/lib_client/michelson_v1_macros.ml @@ -1092,6 +1092,7 @@ let rec unexpand_rec expr = let () = let open Data_encoding in + let open Proto_alpha in register_error_kind `Permanent ~id:"michelson.macros.unexpected_annotation" diff --git a/src/proto_alpha/lib_client/proto_alpha.ml b/src/proto_alpha/lib_client/proto_alpha.ml index b7d6ea11e..286d8fe71 100644 --- a/src/proto_alpha/lib_client/proto_alpha.ml +++ b/src/proto_alpha/lib_client/proto_alpha.ml @@ -66,3 +66,12 @@ class wrap_full (t : Client_context.full) : full = object (t :> RPC_context.t) Shell_services.Blocks.path end + +let register_error_kind + category ~id ~title ~description ?pp + encoding from_error to_error = + let id = "client." ^ Name.name ^ "." ^ id in + register_error_kind + category ~id ~title ~description ?pp + encoding from_error to_error + diff --git a/src/proto_alpha/lib_protocol/test/helpers/proto_alpha.ml b/src/proto_alpha/lib_protocol/test/helpers/proto_alpha.ml index 5bfe3f514..13f35d481 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/proto_alpha.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/proto_alpha.ml @@ -37,3 +37,11 @@ end include Proto module M = Alpha_environment.Lift(Main) + +let register_error_kind + category ~id ~title ~description ?pp + encoding from_error to_error = + let id = "client." ^ Name.name ^ "." ^ id in + register_error_kind + category ~id ~title ~description ?pp + encoding from_error to_error