ENH: Improved error handling when GetError is called on a command that has not called SetError.
This commit is contained in:
parent
8c4795025f
commit
ce484264de
|
@ -120,7 +120,14 @@ public:
|
||||||
* Return the last error string.
|
* Return the last error string.
|
||||||
*/
|
*/
|
||||||
const char* GetError()
|
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.
|
* Returns true if this class is the given class, or a subclass of it.
|
||||||
|
|
|
@ -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: ";
|
std::string message = "CMake Error: ";
|
||||||
if(m1)
|
if(m1)
|
||||||
|
@ -369,6 +370,14 @@ void cmSystemTools::Error(const char* m1, const char* m2)
|
||||||
{
|
{
|
||||||
message += m2;
|
message += m2;
|
||||||
}
|
}
|
||||||
|
if(m3)
|
||||||
|
{
|
||||||
|
message += m3;
|
||||||
|
}
|
||||||
|
if(m4)
|
||||||
|
{
|
||||||
|
message += m4;
|
||||||
|
}
|
||||||
cmSystemTools::s_ErrorOccured = true;
|
cmSystemTools::s_ErrorOccured = true;
|
||||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
::MessageBox(0, message.c_str(), 0, MB_OK);
|
::MessageBox(0, message.c_str(), 0, MB_OK);
|
||||||
|
|
|
@ -94,7 +94,8 @@ public:
|
||||||
/**
|
/**
|
||||||
* Display an error message.
|
* 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.
|
///! Return true if there was an error at any point.
|
||||||
static bool GetErrorOccuredFlag()
|
static bool GetErrorOccuredFlag()
|
||||||
|
|
Loading…
Reference in New Issue