1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-13 01:00:23 +02:00

Fix incorrect error type on missing path.

This commit is contained in:
David Steele
2019-06-04 13:38:05 -04:00
parent 4b91259de8
commit 0ab6f3bb87
4 changed files with 6 additions and 6 deletions

View File

@ -299,7 +299,7 @@ storageInfoList(
result = this->interface.infoList(this->driver, path, callback, callbackData); result = this->interface.infoList(this->driver, path, callback, callbackData);
if (!result && param.errorOnMissing) if (!result && param.errorOnMissing)
THROW_FMT(PathOpenError, STORAGE_ERROR_LIST_INFO_MISSING, strPtr(path)); THROW_FMT(PathMissingError, STORAGE_ERROR_LIST_INFO_MISSING, strPtr(path));
} }
MEM_CONTEXT_TEMP_END(); MEM_CONTEXT_TEMP_END();
@ -339,7 +339,7 @@ storageList(const Storage *this, const String *pathExp, StorageListParam param)
{ {
// Error if requested // Error if requested
if (param.errorOnMissing) if (param.errorOnMissing)
THROW_FMT(PathOpenError, STORAGE_ERROR_LIST_MISSING, strPtr(path)); THROW_FMT(PathMissingError, STORAGE_ERROR_LIST_MISSING, strPtr(path));
// Build an empty list if the directory does not exist by default. This makes the logic in calling functions simpler // Build an empty list if the directory does not exist by default. This makes the logic in calling functions simpler
// when they don't care if the path is missing. // when they don't care if the path is missing.

View File

@ -269,7 +269,7 @@ testRun(void)
TEST_ERROR_FMT( TEST_ERROR_FMT(
queueNeed(strNew("000000010000000100000001"), false, queueSize, walSegmentSize, PG_VERSION_92), queueNeed(strNew("000000010000000100000001"), false, queueSize, walSegmentSize, PG_VERSION_92),
PathOpenError, "unable to list files for missing path '%s/spool/archive/test1/in'", testPath()); PathMissingError, "unable to list files for missing path '%s/spool/archive/test1/in'", testPath());
// ------------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------------
storagePathCreateNP(storageSpoolWrite(), strNew(STORAGE_SPOOL_ARCHIVE_IN)); storagePathCreateNP(storageSpoolWrite(), strNew(STORAGE_SPOOL_ARCHIVE_IN));

View File

@ -175,7 +175,7 @@ testRun(void)
parseOptionList[cfgOptConfigIncludePath].valueList = strLstAddZ(strLstNew(), BOGUS_STR); parseOptionList[cfgOptConfigIncludePath].valueList = strLstAddZ(strLstNew(), BOGUS_STR);
TEST_ERROR( TEST_ERROR(
cfgFileLoad(parseOptionList, backupCmdDefConfigValue, cfgFileLoad(parseOptionList, backupCmdDefConfigValue,
backupCmdDefConfigInclPathValue, oldConfigDefault), PathOpenError, backupCmdDefConfigInclPathValue, oldConfigDefault), PathMissingError,
"unable to list files for missing path '/BOGUS'"); "unable to list files for missing path '/BOGUS'");
// --config-include-path valid, --config invalid (does not exist) // --config-include-path valid, --config invalid (does not exist)

View File

@ -255,7 +255,7 @@ testRun(void)
// ------------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------------
TEST_ERROR_FMT( TEST_ERROR_FMT(
storageInfoListP(storageTest, strNew(BOGUS_STR), (StorageInfoListCallback)1, NULL, .errorOnMissing = true), storageInfoListP(storageTest, strNew(BOGUS_STR), (StorageInfoListCallback)1, NULL, .errorOnMissing = true),
PathOpenError, STORAGE_ERROR_LIST_INFO_MISSING, strPtr(strNewFmt("%s/BOGUS", testPath()))); PathMissingError, STORAGE_ERROR_LIST_INFO_MISSING, strPtr(strNewFmt("%s/BOGUS", testPath())));
TEST_RESULT_BOOL( TEST_RESULT_BOOL(
storageInfoListNP(storageTest, strNew(BOGUS_STR), (StorageInfoListCallback)1, NULL), false, "ignore missing dir"); storageInfoListNP(storageTest, strNew(BOGUS_STR), (StorageInfoListCallback)1, NULL), false, "ignore missing dir");
@ -294,7 +294,7 @@ testRun(void)
// ------------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------------
TEST_ERROR_FMT( TEST_ERROR_FMT(
storageListP(storageTest, strNew(BOGUS_STR), .errorOnMissing = true), PathOpenError, STORAGE_ERROR_LIST_MISSING, storageListP(storageTest, strNew(BOGUS_STR), .errorOnMissing = true), PathMissingError, STORAGE_ERROR_LIST_MISSING,
strPtr(strNewFmt("%s/BOGUS", testPath()))); strPtr(strNewFmt("%s/BOGUS", testPath())));
TEST_RESULT_PTR(storageListP(storageTest, strNew(BOGUS_STR), .nullOnMissing = true), NULL, "null for missing dir"); TEST_RESULT_PTR(storageListP(storageTest, strNew(BOGUS_STR), .nullOnMissing = true), NULL, "null for missing dir");