Substantially improved exception handling.

Exception handling now appropriately detects and prevents infinite
recursion induced by internally thrown exceptions, as is only sane. A
minor panoply of regression fixes also follow.