exceptions
This commit is contained in:
@@ -4,20 +4,12 @@
|
||||
#include "RageLog.h"
|
||||
#include "StepMania.h"
|
||||
|
||||
#include <cstdarg>
|
||||
|
||||
#if defined(_WINDOWS) && defined(DEBUG)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
RageException::RageException( const CString &str ):
|
||||
m_sError(str)
|
||||
{
|
||||
}
|
||||
|
||||
const char* RageException::what() const throw ()
|
||||
{
|
||||
return m_sError;
|
||||
}
|
||||
|
||||
/* This is no longer actually implemented by throwing an exception, but it acts
|
||||
* the same way to code in practice. */
|
||||
void RageException::Throw(const char *fmt, ...)
|
||||
@@ -52,15 +44,6 @@ void RageException::Throw(const char *fmt, ...)
|
||||
HandleException( error );
|
||||
}
|
||||
|
||||
void RageException::ThrowNonfatal(const char *fmt, ...)
|
||||
{
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
CString error = vssprintf( fmt, va );
|
||||
va_end(va);
|
||||
|
||||
throw RageException( error );
|
||||
}
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
|
||||
@@ -5,25 +5,9 @@
|
||||
#ifndef RAGEEXCEPTION_H
|
||||
#define RAGEEXCEPTION_H
|
||||
|
||||
#include <exception>
|
||||
#include <cstdarg>
|
||||
|
||||
class RageException : public exception
|
||||
namespace RageException
|
||||
{
|
||||
public:
|
||||
RageException( const CString &str );
|
||||
|
||||
virtual const char *what() const throw();
|
||||
virtual ~RageException() throw() { }
|
||||
|
||||
/* The only difference between these is that Throw triggers debug behavior
|
||||
* and Nonfatal doesn't. Nonfatal is used when the exception happens
|
||||
* normally and will be caught, such as when a driver fails to initialize. */
|
||||
static void NORETURN Throw(const char *fmt, ...);
|
||||
static void NORETURN ThrowNonfatal(const char *fmt, ...);
|
||||
|
||||
protected:
|
||||
CString m_sError;
|
||||
void NORETURN Throw(const char *fmt, ...);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -111,7 +111,6 @@ RageSoundDriver *MakeRageSoundDriver(CString drivers)
|
||||
|
||||
for(unsigned i = 0; ret == NULL && i < DriversToTry.size(); ++i)
|
||||
{
|
||||
try {
|
||||
Driver = DriversToTry[i];
|
||||
LOG->Trace("Initializing driver: %s", DriversToTry[i].c_str());
|
||||
|
||||
@@ -150,9 +149,6 @@ RageSoundDriver *MakeRageSoundDriver(CString drivers)
|
||||
LOG->Info( "Couldn't load driver %s: %s", DriversToTry[i].c_str(), sError.c_str() );
|
||||
SAFE_DELETE( ret );
|
||||
}
|
||||
} catch(const RageException &e) {
|
||||
LOG->Info("Couldn't load driver %s: %s", DriversToTry[i].c_str(), e.what());
|
||||
}
|
||||
}
|
||||
|
||||
if(ret)
|
||||
|
||||
Reference in New Issue
Block a user