From 24c98a60574b6b560a8f724a453d9e9c9c603a1f Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Mon, 23 Nov 2015 09:25:13 +0000 Subject: [PATCH] Add possibility to retrieve textual description of errors from service load exceptions. --- service.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/service.h b/service.h index a5b3d13..7f4ae22 100644 --- a/service.h +++ b/service.h @@ -60,7 +60,9 @@ class ServiceLoadExc { public: std::string serviceName; + const char *excDescription; + protected: ServiceLoadExc(std::string serviceName) noexcept : serviceName(serviceName) { @@ -73,6 +75,7 @@ class ServiceNotFound : public ServiceLoadExc ServiceNotFound(std::string serviceName) noexcept : ServiceLoadExc(serviceName) { + excDescription = "Not found."; } }; @@ -82,6 +85,7 @@ class ServiceCyclicDependency : public ServiceLoadExc ServiceCyclicDependency(std::string serviceName) noexcept : ServiceLoadExc(serviceName) { + excDescription = "Cyclic dependency."; } }; @@ -93,6 +97,7 @@ class ServiceDescriptionExc : public ServiceLoadExc ServiceDescriptionExc(std::string serviceName, std::string extraInfo) noexcept : ServiceLoadExc(serviceName), extraInfo(extraInfo) { + excDescription = extraInfo.c_str(); } }; -- 2.25.1