package eio

  1. Overview
  2. Docs

Reporting multiple failures at once.

type with_bt = exn * Stdlib.Printexc.raw_backtrace
exception Multiple of exn list

Raised if multiple fibers fail, to report all the exceptions.

val combine : with_bt -> with_bt -> with_bt

combine x y returns a single exception and backtrace to use to represent two errors.

Only one of the backtraces will be kept. The resulting exception is typically just Multiple [y; x], but various heuristics are used to simplify the result:

  • Combining with a Cancel.Cancelled exception does nothing, as these don't need to be reported. The result is only Cancelled if there is no other exception available.
  • If x is a Multiple exception then y is added to it, to avoid nested Multiple exceptions.
  • Duplicate exceptions are removed (using physical equality of the exception).