Exceptions et namespaces
Publié le 17/08/2015 PHP
<?php namespace SomeNamespace; class SomeClass { function SomeFunction() { try { throw new Exception('Some Error Message'); } catch (\Exception $e) { // <<<<<---- L'astuce est ici : il FAUT un backslash ! var_dump($e->getMessage()); } } }
http://php.net/manual/fr/language.exceptions.php#97963