Search⌘ K
AI Features

Reporting Successes and Errors

Explore methods to report successes and errors within Elixir processes using GenServer. Learn how to manage partial successes, halt on failure with Enum.reduce_while, and ensure reliable error handling essential for building fault-tolerant systems.

Reporting partial success

First, let’s report partial success as we go until there’s an error. We’ll enter this at the end of pipeline_errors.exs after the module:

C++
# Add this code after the module in pipeline_error.exs
IO.puts "Report partial success:"
Worker.stream_work
|> Enum.take(10)
|> IO.inspect

To see this in action, we’ll run this script through the following command:

Executable

C++
elixir pipeline_errors.exs

Output

Report partial success:
[
  {:error, %RuntimeError{message: "Oops!"}, 1},
  {:result,
...