HH\Lib\OS\ErrnoException

Facebook Engineer?

This function is available as OS\ErrnoException() in Facebook's www repository.

Base class for exceptions reported via the C errno variable

Subclasses exist for some specific Errno values, such as:

It is strongly recommended to catch subclasses instead of this class if a suitable subclass is defined; for example:

// ANTIPATTERN:
catch (OS\ErrnoException $e) {
  if ($e->getErrno() === OS\Errno::ENOENT) {
    do_stuff();
  }
}
// RECOMMENDED:
catch (OS\NotFoundException $_) {
  do_stuff();
}

If a suitable subclass is not defined, the antipattern is unavoidable.

Interface Synopsis

namespace HH\Lib\OS;

class ErrnoException extends \Exception {...}

Public Methods