mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 14:00:56 +01:00
Give "bin/config" a friendlier error message if "local.json" is not writable
Summary: Ref T13403. We currently emit a useful error message, but it's not tailored and has a stack trace. Since this is a relatively routine error and on the first-time-setup path, tailor it so it's a bit nicer. Test Plan: - Ran `bin/config set ...` with an unwritable "local.json". - Ran `bin/config set ...` normally. Maniphest Tasks: T13403 Differential Revision: https://secure.phabricator.com/D20779
This commit is contained in:
parent
8ff3a133c4
commit
d9badba147
1 changed files with 13 additions and 2 deletions
|
@ -140,11 +140,22 @@ final class PhabricatorConfigManagementSetWorkflow
|
|||
'Wrote configuration key "%s" to database storage.',
|
||||
$key);
|
||||
} else {
|
||||
$config_source = id(new PhabricatorConfigLocalSource())
|
||||
->setKeys(array($key => $value));
|
||||
$config_source = new PhabricatorConfigLocalSource();
|
||||
|
||||
$local_path = $config_source->getReadablePath();
|
||||
|
||||
try {
|
||||
Filesystem::assertWritable($local_path);
|
||||
} catch (FilesystemException $ex) {
|
||||
throw new PhutilArgumentUsageException(
|
||||
pht(
|
||||
'Local path "%s" is not writable. This file must be writable '.
|
||||
'so that "bin/config" can store configuration.',
|
||||
Filesystem::readablePath($local_path)));
|
||||
}
|
||||
|
||||
$config_source->setKeys(array($key => $value));
|
||||
|
||||
$write_message = pht(
|
||||
'Wrote configuration key "%s" to local storage (in file "%s").',
|
||||
$key,
|
||||
|
|
Loading…
Reference in a new issue