<?php

require_once '../../Wact/Loader.inc.php';
Wact_Loader::setupWact();

$handler = new Wact_Exception_Handler();
$handler->install();

function Oops() {
    throw new Wact_Exception_Base('This an exception message');
}

function Collect() {
    $collection = array();
    for ($i = 0; $i < 5; $i++) {
        try {
            Oops();
        } catch (Exception $e) {
            $collection[] = $e;
        }
    }
    if (count($collection) > 0) {
        throw new Wact_Exception_Collection($collection);
    }
}

echo "This is an example of several Wact_Exception_Bases, ";
echo "caught, collected and reraised inside a Wact_Exception_Collection ";
echo "while the Wact_Exception_Handler is active.<br/>\n<hr/>\n";

Collect();
?>