Throw not_found error in API v2 when a batch is not found

pull/7584/head
POA 1 year ago
parent 921e01dc9a
commit bea348df48
  1. 11
      apps/block_scout_web/lib/block_scout_web/controllers/api/v2/zkevm_controller.ex

@ -28,16 +28,19 @@ defmodule BlockScoutWeb.API.V2.ZkevmController do
"""
@spec batch(Plug.Conn.t(), map()) :: Plug.Conn.t()
def batch(conn, %{"batch_number" => batch_number} = _params) do
{:ok, batch} =
Reader.batch(
case Reader.batch(
batch_number,
necessity_by_association: @batch_necessity_by_association,
api?: true
)
) do
{:ok, batch} ->
conn
|> put_status(200)
|> render(:zkevm_batch, %{batch: batch})
{:error, :not_found} = res ->
res
end
end
@doc """

Loading…
Cancel
Save