Browse Source

Add exception when json files can not be read

Jordi Boggiano 14 năm trước cách đây
mục cha
commit
17286e993c
1 tập tin đã thay đổi với 3 bổ sung0 xóa
  1. 3 0
      src/Composer/Json/JsonFile.php

+ 3 - 0
src/Composer/Json/JsonFile.php

@@ -58,6 +58,9 @@ class JsonFile
         ));
         ));
 
 
         $json = file_get_contents($this->path, false, $context);
         $json = file_get_contents($this->path, false, $context);
+        if (!$json) {
+            throw new \RuntimeException('Could not read '.$this->path.', you are probably offline');
+        }
 
 
         return static::parseJson($json);
         return static::parseJson($json);
     }
     }