2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2002-06-14 22:25:22 +00:00
|
|
|
#include "RageException.h"
|
|
|
|
|
#include "RageUtil.h"
|
2002-12-21 18:12:03 +00:00
|
|
|
#include "RageLog.h"
|
2004-11-30 09:08:32 +00:00
|
|
|
#include "StepMania.h"
|
2003-11-15 06:08:13 +00:00
|
|
|
|
2004-12-01 01:11:14 +00:00
|
|
|
#include <cstdarg>
|
|
|
|
|
|
2004-01-31 01:23:20 +00:00
|
|
|
#if defined(_WINDOWS) && defined(DEBUG)
|
2004-11-30 09:08:32 +00:00
|
|
|
#include <windows.h>
|
2003-11-15 06:08:13 +00:00
|
|
|
#endif
|
2002-06-14 22:25:22 +00:00
|
|
|
|
2004-11-30 09:08:32 +00:00
|
|
|
/* This is no longer actually implemented by throwing an exception, but it acts
|
|
|
|
|
* the same way to code in practice. */
|
2002-12-22 03:19:46 +00:00
|
|
|
void RageException::Throw(const char *fmt, ...)
|
2002-12-21 08:13:22 +00:00
|
|
|
{
|
|
|
|
|
va_list va;
|
|
|
|
|
va_start(va, fmt);
|
|
|
|
|
CString error = vssprintf( fmt, va );
|
|
|
|
|
va_end(va);
|
|
|
|
|
|
2003-02-14 19:00:37 +00:00
|
|
|
CString msg = ssprintf(
|
|
|
|
|
"\n"
|
|
|
|
|
"//////////////////////////////////////////////////////\n"
|
|
|
|
|
"Exception: %s\n"
|
|
|
|
|
"//////////////////////////////////////////////////////\n"
|
|
|
|
|
"",
|
2003-04-25 00:01:35 +00:00
|
|
|
error.c_str());
|
2002-12-21 18:12:03 +00:00
|
|
|
if(LOG)
|
|
|
|
|
{
|
2003-04-25 00:01:35 +00:00
|
|
|
LOG->Trace("%s", msg.c_str());
|
2002-12-21 18:12:03 +00:00
|
|
|
LOG->Flush();
|
|
|
|
|
}
|
2003-02-14 19:00:37 +00:00
|
|
|
else
|
|
|
|
|
{
|
2003-04-25 00:01:35 +00:00
|
|
|
printf("%s\n", msg.c_str());
|
2003-02-14 19:00:37 +00:00
|
|
|
fflush(stdout);
|
|
|
|
|
}
|
2002-12-21 18:12:03 +00:00
|
|
|
|
2004-01-31 01:23:20 +00:00
|
|
|
#if defined(_WINDOWS) && defined(DEBUG)
|
2002-12-21 08:13:22 +00:00
|
|
|
DebugBreak();
|
|
|
|
|
#endif
|
|
|
|
|
|
2004-11-30 09:08:32 +00:00
|
|
|
HandleException( error );
|
2002-12-21 08:13:22 +00:00
|
|
|
}
|
|
|
|
|
|
2004-05-06 00:42:06 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2001-2004 Chris Danford
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the
|
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
|
* distribute, and/or sell copies of the Software, and to permit persons to
|
|
|
|
|
* whom the Software is furnished to do so, provided that the above
|
|
|
|
|
* copyright notice(s) and this permission notice appear in all copies of
|
|
|
|
|
* the Software and that both the above copyright notice(s) and this
|
|
|
|
|
* permission notice appear in supporting documentation.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
|
|
|
|
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
|
|
|
|
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
|
|
|
|
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
|
|
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
|
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|