I do this type of thing in Java all the time, and I'm trying to figure out if it's possible in PHP. This is what I would expect the syntax to look like if it was possible, but I'm wondering if there's some special way to do it (if it's possible, that is).
class Foo { public static class FooBarException extends Exception { } public static class BarBazException extends Exception { } public function DoSomething() { try { // Calls to other class methods that can // throw FooBarException and BarBazException } catch (self::FooBarException $e) { // Stuff.. } } } $bang = new Foo(); try { $bang->DoSomething(); } catch (Foo::BarBazException $e) { // Stuff.. }