One request's outcome in a batch: the custom_id it was submitted with
and the result it ended in.
Match on result to handle each outcome:
case result do
%BatchResult{custom_id: id, result: {:ok, message}} -> store(id, message)
%BatchResult{result: {:error, error}} -> log(error)
%BatchResult{result: :canceled} -> :ok
%BatchResult{result: :expired} -> requeue(result.custom_id)
endExpired requests aren't billed — those are ones the batch's 24 hours ran out on before they reached the model.
Summary
Types
@type result() :: {:ok, Claudex.Message.t()} | {:error, Claudex.Error.t()} | :canceled | :expired