public static function detect($callable, $mask = -1)
    {
        $error = null;
        set_error_handler(function ($type, $message, $file, $line) use ($error) {
            $error = new ErrorException($message, 0, $type, $file, $line);
        }, $mask);
        $callable();
        restore_error_handler();
        return $error;
    }