summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2001-03-12 23:30:58 (GMT)
committerBrad King <brad.king@kitware.com>2001-03-12 23:30:58 (GMT)
commitce484264de3ae08a5cca9b6c3f75d1a1f914b4a4 (patch)
tree5c686a8b3b6a065cc6b2a2bd58336e204af94b7b /Source
parent8c4795025fd28088507e5814e167bdfc9f0345f0 (diff)
downloadCMake-ce484264de3ae08a5cca9b6c3f75d1a1f914b4a4.zip
CMake-ce484264de3ae08a5cca9b6c3f75d1a1f914b4a4.tar.gz
CMake-ce484264de3ae08a5cca9b6c3f75d1a1f914b4a4.tar.bz2
ENH: Improved error handling when GetError is called on a command that has not called SetError.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCommand.h9
-rw-r--r--Source/cmSystemTools.cxx11
-rw-r--r--Source/cmSystemTools.h3
3 files changed, 20 insertions, 3 deletions
diff --git a/Source/cmCommand.h b/Source/cmCommand.h
index 55841c4..ebfd609 100644
--- a/Source/cmCommand.h
+++ b/Source/cmCommand.h
@@ -120,7 +120,14 @@ public:
* Return the last error string.
*/
const char* GetError()
- {return m_Error.c_str();}
+ {
+ if(m_Error.length() == 0)
+ {
+ std::string m_Error = this->GetName();
+ m_Error += " uknown error.";
+ }
+ return m_Error.c_str();
+ }
/**
* Returns true if this class is the given class, or a subclass of it.
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 848e7be..f6fff77 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -358,7 +358,8 @@ void cmSystemTools::GetArguments(std::string& line,
}
}
-void cmSystemTools::Error(const char* m1, const char* m2)
+void cmSystemTools::Error(const char* m1, const char* m2,
+ const char* m3, const char* m4)
{
std::string message = "CMake Error: ";
if(m1)
@@ -369,6 +370,14 @@ void cmSystemTools::Error(const char* m1, const char* m2)
{
message += m2;
}
+ if(m3)
+ {
+ message += m3;
+ }
+ if(m4)
+ {
+ message += m4;
+ }
cmSystemTools::s_ErrorOccured = true;
#if defined(_WIN32) && !defined(__CYGWIN__)
::MessageBox(0, message.c_str(), 0, MB_OK);
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index da94820..fbc8c68 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -94,7 +94,8 @@ public:
/**
* Display an error message.
*/
- static void Error(const char* m, const char* m2=0 );
+ static void Error(const char* m, const char* m2=0,
+ const char* m3=0, const char* m4=0);
///! Return true if there was an error at any point.
static bool GetErrorOccuredFlag()