From 0648dc39a6cf7cdbc8c162ffc22a8fed38c8d66a Mon Sep 17 00:00:00 2001 From: Awea Date: Mon, 21 Oct 2024 09:57:27 +0200 Subject: [PATCH] fix(rpc): handle nil value in preapply result --- lib/rpc.ex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/rpc.ex b/lib/rpc.ex index 62c7145..bd76059 100644 --- a/lib/rpc.ex +++ b/lib/rpc.ex @@ -239,7 +239,7 @@ defmodule Tezex.Rpc do defp do_preapply_operation(%Rpc{} = rpc, payload) do case post(rpc, "/blocks/head/helpers/preapply/operations", payload) do - {:ok, [%{"contents" => preapplied_operations}]} -> + {:ok, [%{"contents" => preapplied_operations}]} when is_list(preapplied_operations) -> applied? = Enum.all?( preapplied_operations, @@ -275,8 +275,8 @@ defmodule Tezex.Rpc do {:error, errors} end - {:ok, result} -> - {:error, result} + {:ok, _result} -> + {:error, :preapply_failed} err -> err