瀏覽代碼

Add exception when json files can not be read

Jordi Boggiano 13 年之前
父節點
當前提交
17286e993c
共有 1 個文件被更改,包括 3 次插入0 次删除
  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);
+        if (!$json) {
+            throw new \RuntimeException('Could not read '.$this->path.', you are probably offline');
+        }
 
         return static::parseJson($json);
     }