You mean something like
else {
throw new XException(...);
throw new YException(...);
throw new ZException(...);
}
... and all of them are thrown "at once"?
No, thats not possible and wouldn´t make too much sense imho. How should the client code catching these exceptions look?
Furthermore you shouldn´t use exceptions as a replacement for normal flow control structures, exceptions should only handle, well, exceptional errors, like not being able to connect to a database etc.
You could implement another custom exception class which takes an array of errors as an argument, and the client code can do things like:
catch(SomeException $e) {
$messages = $e->getErrorMessages();
}
As I don´t speak the language your language, I cant really tell what you are trying to do in that code bit you posted, otherwise I could suggest something more specific.
EDIT/UPDATE:
@MEM thanks for updating your code with english error messages. Are you implementing something like a domain registration service?
Of course, this is a bit of a difficult topic as everbody has his preferences, but I wouldn´t throw an exception if e. g. the user tried to register a domain thats already been used by someone else. This is not an exceptional state, this is to be excepted. I would make a validation class/method which collects these error messages which in turn get displayed to the user.
When would I throw an exception in an app like yours? I don´t know much about domain registration, but if you are fetching the info whether a domain is free or not from a remote server/webservice and this webservice is down, then I would throw an exception. It gets caught in the Controller (I image a MVC web app) which in turn replies to the client with a "Server down, please try again later" message.