How Yii Handles Exceptions In Ajax Calls?

When actionDelete() in a controller throws an exception, this exception is displayed by alert().

I don’t understand how it works that it’s displayed even when deletion is called through AJAX (as in /admin).