aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-09-15 15:23:47 +0200
committerStefan Boberg <[email protected]>2021-09-15 15:23:47 +0200
commitf34aa060d7da16d4e08644cf8572db979f3ea8d0 (patch)
treec7c5e5f961c971e2c8e93f542241c7817aa9e3fb
parentMade logging macros always append `sv` string_view literal suffix (diff)
downloadzen-f34aa060d7da16d4e08644cf8572db979f3ea8d0.tar.xz
zen-f34aa060d7da16d4e08644cf8572db979f3ea8d0.zip
Changed `std::exception` into `std::runtime_error` since `std::exception` does not have a constructor which accepts a string argument in the standard (this appears to be an MSVC implementation thing)
-rw-r--r--zen/cmds/copy.cpp10
-rw-r--r--zen/cmds/deploy.cpp6
-rw-r--r--zenserver/compute/apply.cpp8
-rw-r--r--zenserver/config.cpp2
-rw-r--r--zenserver/projectstore.cpp4
-rw-r--r--zenserver/testing/launch.cpp2
-rw-r--r--zenserver/zenserver.cpp2
-rw-r--r--zenstore/caslog.cpp2
-rw-r--r--zenutil/zenserverprocess.cpp4
9 files changed, 20 insertions, 20 deletions
diff --git a/zen/cmds/copy.cpp b/zen/cmds/copy.cpp
index 2830f8c28..4ce09c982 100644
--- a/zen/cmds/copy.cpp
+++ b/zen/cmds/copy.cpp
@@ -37,10 +37,10 @@ CopyCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
// Validate arguments
if (m_CopySource.empty())
- throw std::exception("No source specified");
+ throw std::runtime_error("No source specified");
if (m_CopyTarget.empty())
- throw std::exception("No target specified");
+ throw std::runtime_error("No target specified");
std::filesystem::path FromPath;
std::filesystem::path ToPath;
@@ -53,12 +53,12 @@ CopyCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
if (!IsFileCopy && !IsDirCopy)
{
- throw std::exception("Invalid source specification (neither directory nor file)");
+ throw std::runtime_error("Invalid source specification (neither directory nor file)");
}
if (IsFileCopy && IsDirCopy)
{
- throw std::exception("Invalid source specification (both directory AND file!?)");
+ throw std::runtime_error("Invalid source specification (both directory AND file!?)");
}
if (IsDirCopy)
@@ -70,7 +70,7 @@ CopyCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
{
if (std::filesystem::is_regular_file(ToPath))
{
- throw std::exception("Attempted copy of directory into file");
+ throw std::runtime_error("Attempted copy of directory into file");
}
}
}
diff --git a/zen/cmds/deploy.cpp b/zen/cmds/deploy.cpp
index bee7baf90..b8879fefb 100644
--- a/zen/cmds/deploy.cpp
+++ b/zen/cmds/deploy.cpp
@@ -38,10 +38,10 @@ DeployCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
// Validate arguments
if (m_CopySource.empty())
- throw std::exception("No source specified");
+ throw std::runtime_error("No source specified");
if (m_CopyTarget.empty())
- throw std::exception("No target specified");
+ throw std::runtime_error("No target specified");
std::filesystem::path ToPath;
@@ -52,7 +52,7 @@ DeployCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
if (!IsTargetNew && !IsTargetDir)
{
- throw std::exception("Invalid target specification (needs to be a directory)");
+ throw std::runtime_error("Invalid target specification (needs to be a directory)");
}
zen::ExtendableStringBuilder<128> Path8;
diff --git a/zenserver/compute/apply.cpp b/zenserver/compute/apply.cpp
index 6eeb6cf70..c3d83b2b5 100644
--- a/zenserver/compute/apply.cpp
+++ b/zenserver/compute/apply.cpp
@@ -114,7 +114,7 @@ BasicFunctionJob::Wait(uint32_t TimeoutMs)
return true;
}
- throw std::exception("Failed wait on process handle");
+ throw std::runtime_error("Failed wait on process handle");
}
int
@@ -667,7 +667,7 @@ HttpFunctionService::ExecAction(const WorkerDesc& Worker, CbObject Action)
if (!DataBuffer)
{
- throw std::exception("Chunk missing" /* ADD CONTEXT */);
+ throw std::runtime_error("Chunk missing" /* ADD CONTEXT */);
}
zen::WriteFile(FilePath, DataBuffer);
@@ -693,7 +693,7 @@ HttpFunctionService::ExecAction(const WorkerDesc& Worker, CbObject Action)
if (!DataBuffer)
{
- throw std::exception("Chunk missing" /* ADD CONTEXT */);
+ throw std::runtime_error("Chunk missing" /* ADD CONTEXT */);
}
zen::WriteFile(FilePath, DataBuffer);
@@ -712,7 +712,7 @@ HttpFunctionService::ExecAction(const WorkerDesc& Worker, CbObject Action)
if (!DataBuffer)
{
- throw std::exception("Chunk missing" /* ADD CONTEXT */);
+ throw std::runtime_error("Chunk missing" /* ADD CONTEXT */);
}
zen::WriteFile(FilePath, DataBuffer);
diff --git a/zenserver/config.cpp b/zenserver/config.cpp
index ae624b169..578a3a202 100644
--- a/zenserver/config.cpp
+++ b/zenserver/config.cpp
@@ -242,7 +242,7 @@ ParseServiceConfig(const std::filesystem::path& DataRoot, ZenServiceConfig& Serv
{
ZEN_ERROR("config script failure: {}", e.what());
- throw std::exception("fatal zen global config script ({}) failure: {}"_format(ConfigScript, e.what()).c_str());
+ throw std::runtime_error("fatal zen global config script ({}) failure: {}"_format(ConfigScript, e.what()).c_str());
}
ServiceConfig.MeshEnabled = lua["mesh"]["enable"].get_or(ServiceConfig.MeshEnabled);
diff --git a/zenserver/projectstore.cpp b/zenserver/projectstore.cpp
index 79cd250dc..404484edf 100644
--- a/zenserver/projectstore.cpp
+++ b/zenserver/projectstore.cpp
@@ -142,14 +142,14 @@ struct ProjectStore::OplogStorage : public RefCounted
}
else
{
- throw std::exception("column family iteration failed for '{}': '{}'"_format(RocksdbPath, Status.getState()).c_str());
+ throw std::runtime_error("column family iteration failed for '{}': '{}'"_format(RocksdbPath, Status.getState()).c_str());
}
Status = rocksdb::DB::Open(Options, RocksdbPath, ColumnDescriptors, &m_RocksDbColumnHandles, &Db);
if (!Status.ok())
{
- throw std::exception("database open failed for '{}': '{}'"_format(RocksdbPath, Status.getState()).c_str());
+ throw std::runtime_error("database open failed for '{}': '{}'"_format(RocksdbPath, Status.getState()).c_str());
}
m_RocksDb.reset(Db);
diff --git a/zenserver/testing/launch.cpp b/zenserver/testing/launch.cpp
index 608b515e1..55695ac9c 100644
--- a/zenserver/testing/launch.cpp
+++ b/zenserver/testing/launch.cpp
@@ -105,7 +105,7 @@ BasicJob::Wait(uint32_t TimeoutMs)
return true;
}
- throw std::exception("Failed wait on process handle");
+ throw std::runtime_error("Failed wait on process handle");
}
int
diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp
index 931fe062e..3b56d8683 100644
--- a/zenserver/zenserver.cpp
+++ b/zenserver/zenserver.cpp
@@ -112,7 +112,7 @@ public:
if (zen::NamedMutex::Exists(MutexName) || (m_ServerMutex.Create(MutexName) == false))
{
- throw std::exception("Failed to create mutex '{}' - is another instance already running?"_format(MutexName).c_str());
+ throw std::runtime_error("Failed to create mutex '{}' - is another instance already running?"_format(MutexName).c_str());
}
// Ok so now we're configured, let's kick things off
diff --git a/zenstore/caslog.cpp b/zenstore/caslog.cpp
index 34860538a..70bcf4669 100644
--- a/zenstore/caslog.cpp
+++ b/zenstore/caslog.cpp
@@ -81,7 +81,7 @@ CasLogFile::Open(std::filesystem::path FileName, size_t RecordSize, bool IsCreat
if ((0 != memcmp(Header.Magic, FileHeader::MagicSequence, sizeof Header.Magic)) || (Header.Checksum != Header.ComputeChecksum()))
{
// TODO: provide more context!
- throw std::exception("Mangled log header");
+ throw std::runtime_error("Mangled log header");
}
ULONGLONG Sz;
diff --git a/zenutil/zenserverprocess.cpp b/zenutil/zenserverprocess.cpp
index 3d8f33559..00f5d4c0d 100644
--- a/zenutil/zenserverprocess.cpp
+++ b/zenutil/zenserverprocess.cpp
@@ -524,7 +524,7 @@ ZenServerInstance::AttachToRunningServer(int BasePort)
if (!State.InitializeReadOnly())
{
// TODO: return success/error code instead?
- throw std::exception("No zen state found");
+ throw std::runtime_error("No zen state found");
}
const ZenServerState::ZenServerEntry* Entry = nullptr;
@@ -541,7 +541,7 @@ ZenServerInstance::AttachToRunningServer(int BasePort)
if (!Entry)
{
// TODO: return success/error code instead?
- throw std::exception("No server found");
+ throw std::runtime_error("No server found");
}
m_Process.Initialize(Entry->Pid);