As per standard functionality, when one tries to create/update a user record with a username value that is NOT unique across all Salesforce orgs, then the following error message is returned:
Duplicate Username.
The username already exists in this or another Salesforce organization. Usernames must be unique across all Salesforce organizations. To resolve, use a different username (it doesn't need to match the user's email address).
I tried to bypass this with a before insert User trigger to say 'if any DML exception is hit, then append a value to the username' such that one wouldn't hit such errors.
I created the most granular debug log level but I don't see any DML exception or any other 'hook' that I could use for this.
It would seem that this exception is just not available to developers in any logs. Is this correct?