Skip to content

Commit

Permalink
Cache failed to be optional
Browse files Browse the repository at this point in the history
  • Loading branch information
antecedent committed Aug 7, 2014
1 parent 0c08d9f commit 7021972
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Patchwork.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ function undoAll()
Interceptor\unpatchAll();
}

function enableCaching($location)
function enableCaching($location, $assertWritable = true)
{
Preprocessor\setCacheLocation($location);
Preprocessor\setCacheLocation($location, $assertWritable);
}

function blacklist($path)
Expand Down
4 changes: 2 additions & 2 deletions lib/Exceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ function __construct($callback)
}
}

class CacheLocationReadOnly extends Exception
class CacheLocationUnavailable extends Exception
{
public function __construct($location)
{
parent::__construct(sprintf(
"The specified cache location is read-only: %s",
"The specified cache location is inexistent or read-only: %s",
$location
));
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Preprocessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function setCacheLocation($location, $assertWritable = true)
$location = Utils\normalizePath($location);
if (!is_writable($location)) {
if ($assertWritable) {
throw new Exceptions\CacheLocationReadOnly($location);
throw new Exceptions\CacheLocationUnavailable($location);
}
return false;
}
Expand Down

0 comments on commit 7021972

Please sign in to comment.