Fix exception messages
authorAleksei Vereshchagin <avereschagin@dev.rtsoft.ru>
Tue, 3 Apr 2018 23:30:21 +0000 (02:30 +0300)
committerAleksei Vereshchagin <avereschagin@dev.rtsoft.ru>
Wed, 4 Apr 2018 13:04:46 +0000 (16:04 +0300)
src/config/commonconfigconversions.cpp
src/config/configurationmanager.cpp
src/config/fileconfigprovider.cpp
src/config/loggerconfig.cpp
src/config/loggerconfigconversions.cpp
src/config/profilerconfig.cpp
src/config/profilerconfigconversions.cpp
src/config/tracelogconfig.cpp
src/config/tracelogconfigconversions.cpp
src/storage/ringbuffer.h
src/sync/shared_mutex.cpp

index 17b55b1800dbdb16ab9dad58959550cfa4db4f1c..214321f5545f3afcf0a0d580f67d8b3356a945fe 100644 (file)
@@ -50,7 +50,7 @@ bool convert(const char *str)
     }
     else
     {
-        throw bad_conversion("incorrect value for type bool");
+        throw bad_conversion("Incorrect value for type bool");
     }
 }
 
@@ -65,17 +65,17 @@ unsigned long convert(const char *str)
 
     if (errno == ERANGE)
     {
-        throw bad_conversion("is out of range for unsigned long");
+        throw bad_conversion("Is out of range for unsigned long");
     }
 
     if (str == str_end)
     {
-        throw bad_conversion("incorrect value for type unsigned long");
+        throw bad_conversion("Incorrect value for type unsigned long");
     }
 
     if (*str_end != '\0')
     {
-        throw bad_conversion("contains not number symbols");
+        throw bad_conversion("Contains not number symbols");
     }
 
     return value;
index 860a290e427a923bbce3719fe419b5096133cb32..4af15591b6f28628f6df75bd258358137a264042 100644 (file)
@@ -70,7 +70,7 @@ bool ConfigurationManager::FetchValue(const std::string &name, T &value) const
         catch (const std::runtime_error &e)
         {
             std::stringstream ss;
-            ss << "variable " << name << "=" << str_value <<
+            ss << "Variable " << name << "=" << str_value <<
                 " can't be parsed: " << e.what();
             throw config_error(ss.str());
         }
index 8ba4ef0012fa35215c8557f3fcce507bed334dc3..12aafd5a987e7661843e3ef798b983892297d57d 100644 (file)
@@ -40,7 +40,7 @@ FileConfigProvider::FileConfigProvider(const std::string &filename)
         bool is_name = true;
         auto parse_error = std::runtime_error(
             "FileConfigProvider::FileConfigProvider(): "
-            "can't parse config file (syntax error)"
+            "Can't parse config file (syntax error)"
         );
 
         if (line[0] == '=')
@@ -93,14 +93,14 @@ FileConfigProvider::FileConfigProvider(const std::string &filename)
             throw std::system_error(
                 errno, std::system_category(),
                 "FileConfigProvider::FileConfigProvider(): "
-                "can't parse config file"
+                "Can't parse config file"
             );
         }
         else
         {
             throw std::runtime_error(
                 "FileConfigProvider::FileConfigProvider(): "
-                "can't parse config file (unknown error)"
+                "Can't parse config file (unknown error)"
             );
         }
     }
index fac7af781d627196840294c46d49d037d5e975ca..1f43473e7422bf890e106b385d38a0cf7567c3a4 100644 (file)
@@ -30,7 +30,7 @@ void LoggerConfig::Validate()
 {
     if (OutputStream == LoggerOutputStream::File && FileName.empty())
     {
-        throw config_error("file name is required for file output");
+        throw config_error("File name is required for file output");
     }
 }
 
index c42c2071841de004ca14363d64e49d6e9b5c5b9e..1f82f6b68c8d918b98887bc5565cbebb9f381bba 100644 (file)
@@ -67,23 +67,23 @@ LogLevel convert(const char *str)
 
     if (errno == ERANGE)
     {
-        throw bad_conversion("is out of range");
+        throw bad_conversion("Is out of range");
     }
 
     if (str == str_end)
     {
-        throw bad_conversion("incorrect value for type LogLevel");
+        throw bad_conversion("Incorrect value for type LogLevel");
     }
 
     if (*str_end != '\0')
     {
-        throw bad_conversion("contains not number symbols");
+        throw bad_conversion("Contains not number symbols");
     }
 
     if (value < static_cast<long>(LogLevel::None) ||
         value > static_cast<long>(LogLevel::All))
     {
-        throw bad_conversion("is out of range");
+        throw bad_conversion("Is out of range");
     }
 
     return static_cast<LogLevel>(value);
@@ -106,6 +106,6 @@ LoggerOutputStream convert(const char *str)
     }
     else
     {
-        throw bad_conversion("incorrect value for type LoggerOutputStream");
+        throw bad_conversion("Incorrect value for type LoggerOutputStream");
     }
 }
index 2e190385ee603bb0132121e3f7a0c1765cc91459..bcbc29f3778debc81393f100b14db616f0f63506 100644 (file)
@@ -43,7 +43,7 @@ void ProfilerConfig::Validate()
     {
         if (SamplingTimeoutMs == 0)
         {
-            throw config_error("sampling timeout should be non-zero");
+            throw config_error("Sampling timeout should be non-zero");
         }
     }
 
index d55c3f1ca6640aac0f1e6f8719d3fbb933dc0ed0..2b91b463c9975799380a93776f272c97cea99406 100644 (file)
@@ -37,7 +37,7 @@ CollectionMethod convert(const char *str)
     }
     else
     {
-        throw bad_conversion("incorrect value for type CollectionMethod");
+        throw bad_conversion("Incorrect value for type CollectionMethod");
     }
 }
 
@@ -54,9 +54,5 @@ const char *convert(CollectionMethod method)
 
     case CollectionMethod::Sampling:
         return "Sampling";
-
-    default:
-        assert(!"Unreachable");
-        return "UNKNOWN";
     }
 }
index 683569c18fbb5e7d5be8f45e1372f0a379972773..f5a604a1741d3c082de6e617855ca4a207b54c90 100644 (file)
@@ -29,7 +29,7 @@ void TraceLogConfig::Validate()
 {
     if (OutputStream == TraceLogOutputStream::File && FileName.empty())
     {
-        throw config_error("file name is required for file output");
+        throw config_error("File name is required for file output");
     }
 }
 
index 3ea2098a77dd0b6c6ae61a04cbcedb8c6025246c..453b9d9c55511fb19d0eb1a4676394a25ad31b36 100644 (file)
@@ -35,6 +35,6 @@ TraceLogOutputStream convert(const char *str)
     }
     else
     {
-        throw bad_conversion("incorrect value for type TraceLogOutputStream");
+        throw bad_conversion("Incorrect value for type TraceLogOutputStream");
     }
 }
index c5d59fc024200771de66d9156640a3ad79bcb8f6..f645fd9b406218cdce83eef974f0942906c7b822 100644 (file)
@@ -265,7 +265,7 @@ private:
         if (capacity == 0)
             return;
         else if (capacity > max_size())
-            throw std::length_error("capacity exceeds the maximum size");
+            throw std::length_error("Capacity exceeds the maximum size");
 
         m_buf = reinterpret_cast<T*>(malloc(capacity * sizeof(T)));
 
index 10d42d2d91945461a71c2c574375ffb58e1f74e7..a58660643ae01c85a30e8fe5b8503cc7f905deff 100644 (file)
@@ -32,7 +32,7 @@ shared_mutex::shared_mutex()
     if (pthread_rwlock_init(&pimpl->rwlock, NULL))
     {
         throw std::system_error(errno, std::system_category(),
-            "can't create shared_mutex");
+            "Can't create shared_mutex");
     }
 }
 
@@ -46,7 +46,7 @@ void shared_mutex::lock()
     if (pthread_rwlock_wrlock(&pimpl->rwlock))
     {
         throw std::system_error(errno, std::system_category(),
-            "can't lock shared_mutex");
+            "Can't lock shared_mutex");
     }
 }
 
@@ -57,7 +57,7 @@ bool shared_mutex::try_lock()
     if (err && err != EBUSY)
     {
         throw std::system_error(errno, std::system_category(),
-            "can't exclusively lock shared_mutex");
+            "Can't exclusively lock shared_mutex");
     }
 
     return err == 0;
@@ -68,7 +68,7 @@ void shared_mutex::unlock()
     if (pthread_rwlock_unlock(&pimpl->rwlock))
     {
         throw std::system_error(errno, std::system_category(),
-            "can't exclusively unlock shared_mutex");
+            "Can't exclusively unlock shared_mutex");
     }
 }
 
@@ -77,7 +77,7 @@ void shared_mutex::lock_shared()
     if (pthread_rwlock_rdlock(&pimpl->rwlock))
     {
         throw std::system_error(errno, std::system_category(),
-            "can't shared lock shared_mutex");
+            "Can't shared lock shared_mutex");
     }
 }
 
@@ -88,7 +88,7 @@ bool shared_mutex::try_lock_shared()
     if (err && err != EBUSY)
     {
         throw std::system_error(errno, std::system_category(),
-            "can't shared lock shared_mutex");
+            "Can't shared lock shared_mutex");
     }
 
     return err == 0;
@@ -99,6 +99,6 @@ void shared_mutex::unlock_shared()
     if (pthread_rwlock_unlock(&pimpl->rwlock))
     {
         throw std::system_error(errno, std::system_category(),
-            "can't shared unlock shared_mutex");
+            "Can't shared unlock shared_mutex");
     }
 }