From 4c3f8d84128a61f1b9af4260054ab5e4042b08ee Mon Sep 17 00:00:00 2001 From: Kevin Rocard Date: Thu, 21 Nov 2013 12:16:28 +0100 Subject: Make "Path not found" error more verbose BZ: 156207 When an error occurs while using a path one does not know which path it refers to. Append the unfound path to the error : "Path not found: /the/path/that/was/not/found" Change-Id: If53c1a5c301906b464d38f604d6e97029f83ae3f Signed-off-by: Kevin Rocard --- parameter/ElementLocator.cpp | 6 +++--- parameter/ParameterMgr.cpp | 6 +++--- parameter/PathNavigator.cpp | 8 +++++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/parameter/ElementLocator.cpp b/parameter/ElementLocator.cpp index 6e5ffb7..2720c7b 100644 --- a/parameter/ElementLocator.cpp +++ b/parameter/ElementLocator.cpp @@ -48,7 +48,7 @@ bool CElementLocator::locate(const string& strPath, CElement** ppElement, string if (_bStrict) { - strError = "Path not found"; + strError = "Path not found: " + strPath; return false; } @@ -58,7 +58,7 @@ bool CElementLocator::locate(const string& strPath, CElement** ppElement, string if (*pStrChildName != _pSubRootElement->getName()) { - strError = "Path not found"; + strError = "Path not found: " + strPath; return false; } @@ -68,7 +68,7 @@ bool CElementLocator::locate(const string& strPath, CElement** ppElement, string if (!*ppElement) { - strError = "Path not found"; + strError = "Path not found: " + strPath; return false; } diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp index 59dc057..a07cc57 100644 --- a/parameter/ParameterMgr.cpp +++ b/parameter/ParameterMgr.cpp @@ -715,7 +715,7 @@ const CConfigurableElement* CParameterMgr::getConfigurableElement(const string& if (!pElement) { - strError = "Path not found"; + strError = "Path not found: " + strPath; return NULL; } @@ -734,14 +734,14 @@ CParameterHandle* CParameterMgr::createParameterHandle(const string& strPath, st if (!pConfigurableElement) { // Element not found - strError = "Element not found"; + strError = "Element not found: " + strPath; return NULL; } if (!pConfigurableElement->isParameter()) { // Element is not parameter - strError = "Not a parameter"; + strError = "Not a parameter: " + strPath; return NULL; } diff --git a/parameter/PathNavigator.cpp b/parameter/PathNavigator.cpp index 34b1e65..c09e11a 100644 --- a/parameter/PathNavigator.cpp +++ b/parameter/PathNavigator.cpp @@ -49,7 +49,7 @@ bool CPathNavigator::navigateThrough(const string& strItemName, string& strError { if (!_bValid) { - strError = "Path not well formed"; + strError = "Path not well formed: " + getCurrentPath(); return false; } @@ -58,14 +58,16 @@ bool CPathNavigator::navigateThrough(const string& strItemName, string& strError if (!pStrChildName) { - strError = "Path not complete"; + strError = "Path not complete: " + getCurrentPath() + + ", trying to access to " + strItemName; return false; } if (*pStrChildName != strItemName) { - strError = "Path not found"; + strError = "Path not found: " + getCurrentPath() + + ", expected: " + strItemName + " but found: " + *pStrChildName; return false; } -- cgit v1.1