summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestResourceSpec.h
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2019-12-26 21:02:52 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2019-12-27 15:53:52 (GMT)
commitb393b32b4bb0bc830edc89df6262ad710cd0a3e2 (patch)
tree1821b45e3d1e2655e833e755819548addabfa68e /Source/CTest/cmCTestResourceSpec.h
parent51cc3f1bff2c3637365a9046c2808cd2cf02927b (diff)
downloadCMake-b393b32b4bb0bc830edc89df6262ad710cd0a3e2.zip
CMake-b393b32b4bb0bc830edc89df6262ad710cd0a3e2.tar.gz
CMake-b393b32b4bb0bc830edc89df6262ad710cd0a3e2.tar.bz2
CTest: Improve error handling when reading resource spec file
Fixes: #20079
Diffstat (limited to 'Source/CTest/cmCTestResourceSpec.h')
-rw-r--r--Source/CTest/cmCTestResourceSpec.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/Source/CTest/cmCTestResourceSpec.h b/Source/CTest/cmCTestResourceSpec.h
index 4646db8..cb242c0 100644
--- a/Source/CTest/cmCTestResourceSpec.h
+++ b/Source/CTest/cmCTestResourceSpec.h
@@ -31,7 +31,22 @@ public:
Socket LocalSocket;
- bool ReadFromJSONFile(const std::string& filename);
+ enum class ReadFileResult
+ {
+ READ_OK,
+ FILE_NOT_FOUND,
+ JSON_PARSE_ERROR,
+ INVALID_ROOT,
+ NO_VERSION,
+ INVALID_VERSION,
+ UNSUPPORTED_VERSION,
+ INVALID_SOCKET_SPEC, // Can't be INVALID_SOCKET due to a Windows macro
+ INVALID_RESOURCE_TYPE,
+ INVALID_RESOURCE,
+ };
+
+ ReadFileResult ReadFromJSONFile(const std::string& filename);
+ static const char* ResultToString(ReadFileResult result);
bool operator==(const cmCTestResourceSpec& other) const;
bool operator!=(const cmCTestResourceSpec& other) const;