You got to use this:
try { $result = intdiv(4, 0); } catch(DivisionByZeroError $e) { d($e->getMessage()); } PHP manual : http://php.net/manual/en/class.divisionbyzeroerror.php (Works with PHP 7 onwards)
Update: Using intdiv() - Integer division (Works with PHP 7 onwards)