How to ignore an exception in php? [closed]

3

I am consuming a method of a legacy system that generates scanning of some FTP directories and searching for files. However, if it accesses a directory that does not have files, it throws an exception. Is there any way I can use this method, but ignore it if it generates this exception? (without changing the original method)

    
asked by anonymous 16.09.2015 / 17:28

1 answer

5

If the goal is to deal with exceptions, nothing better than try / catch :

try {
  chamarMetodo();
}
catch (Exception $e) {
  // lidar com erro
}

For more information, read: link

    
16.09.2015 / 17:33