2009-09-08 12:08:10 +00:00
|
|
|
/* PCSX2 - PS2 Emulator for PCs
|
2010-05-03 14:08:02 +00:00
|
|
|
* Copyright (C) 2002-2010 PCSX2 Dev Team
|
2009-09-13 20:56:22 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU Lesser General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
2009-02-09 21:15:56 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
2009-02-09 21:15:56 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along with PCSX2.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
2009-02-09 21:15:56 +00:00
|
|
|
*/
|
|
|
|
|
2009-04-07 21:54:50 +00:00
|
|
|
#pragma once
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2010-10-18 16:09:00 +00:00
|
|
|
#include "Assertions.h"
|
2016-01-27 17:50:51 +00:00
|
|
|
#include <memory>
|
2009-07-03 00:49:40 +00:00
|
|
|
|
2014-12-12 20:46:52 +00:00
|
|
|
// Because wxTrap isn't available on Linux builds of wxWidgets (non-Debug, typically)
|
|
|
|
void pxTrap();
|
|
|
|
|
2009-09-13 17:11:35 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// DESTRUCTOR_CATCHALL - safe destructor helper
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// In C++ destructors *really* need to be "nothrow" garaunteed, otherwise you can have
|
|
|
|
// disasterous nested exception throws during the unwinding process of an originating
|
|
|
|
// exception. Use this macro to dispose of these dangerous exceptions, and generate a
|
|
|
|
// friendly error log in their wake.
|
|
|
|
//
|
2015-09-23 07:22:29 +00:00
|
|
|
// Note: Console can also fire an Exception::OutOfMemory
|
2009-09-13 20:56:22 +00:00
|
|
|
#define __DESTRUCTOR_CATCHALL( funcname ) \
|
2010-04-27 13:12:03 +00:00
|
|
|
catch( BaseException& ex ) \
|
2009-09-13 17:11:35 +00:00
|
|
|
{ \
|
2015-09-23 07:22:29 +00:00
|
|
|
try { \
|
|
|
|
Console.Error( "Unhandled BaseException in %s (ignored!):", funcname ); \
|
|
|
|
Console.Error( ex.FormatDiagnosticMessage() ); \
|
|
|
|
} catch (...) { \
|
|
|
|
fprintf(stderr, "ERROR: (out of memory?)\n"); \
|
|
|
|
} \
|
2009-09-13 17:11:35 +00:00
|
|
|
} \
|
|
|
|
catch( std::exception& ex ) \
|
|
|
|
{ \
|
2015-09-23 07:22:29 +00:00
|
|
|
try { \
|
|
|
|
Console.Error( "Unhandled std::exception in %s (ignored!):", funcname ); \
|
|
|
|
Console.Error( ex.what() ); \
|
|
|
|
} catch (...) { \
|
|
|
|
fprintf(stderr, "ERROR: (out of memory?)\n"); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
catch(...) { \
|
|
|
|
/* Unreachable code */ \
|
2009-09-13 20:56:22 +00:00
|
|
|
}
|
|
|
|
|
2009-12-14 12:18:55 +00:00
|
|
|
#define DESTRUCTOR_CATCHALL __DESTRUCTOR_CATCHALL( __pxFUNCTION__ )
|
2009-09-13 17:11:35 +00:00
|
|
|
|
2009-02-09 21:15:56 +00:00
|
|
|
namespace Exception
|
|
|
|
{
|
2009-09-29 19:16:00 +00:00
|
|
|
int MakeNewType();
|
2010-10-18 15:46:05 +00:00
|
|
|
BaseException* FromErrno( const wxString& streamname, int errcode );
|
2009-09-29 19:16:00 +00:00
|
|
|
|
2009-09-13 17:11:35 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// BaseException
|
|
|
|
// --------------------------------------------------------------------------------------
|
2009-04-27 02:04:31 +00:00
|
|
|
// std::exception sucks, and isn't entirely cross-platform reliable in its implementation,
|
2009-09-01 00:43:28 +00:00
|
|
|
// so I made a replacement. The internal messages are non-const, which means that a
|
|
|
|
// catch clause can optionally modify them and then re-throw to a top-level handler.
|
2009-04-27 02:04:31 +00:00
|
|
|
//
|
2009-02-09 21:15:56 +00:00
|
|
|
// Note, this class is "abstract" which means you shouldn't use it directly like, ever.
|
2009-12-14 12:18:55 +00:00
|
|
|
// Use Exception::RuntimeError instead for generic exceptions.
|
2009-04-27 02:04:31 +00:00
|
|
|
//
|
2009-09-01 00:43:28 +00:00
|
|
|
// Because exceptions are the (only!) really useful example of multiple inheritance,
|
|
|
|
// this class has only a trivial constructor, and must be manually initialized using
|
|
|
|
// InitBaseEx() or by individual member assignments. This is because C++ multiple inheritence
|
|
|
|
// is, by design, a lot of fail, especially when class initializers are mixed in.
|
|
|
|
//
|
|
|
|
// [TODO] : Add an InnerException component, and Clone() facility.
|
|
|
|
//
|
2009-02-09 21:15:56 +00:00
|
|
|
class BaseException
|
|
|
|
{
|
|
|
|
protected:
|
2009-09-01 00:43:28 +00:00
|
|
|
wxString m_message_diag; // (untranslated) a "detailed" message of what disastrous thing has occurred!
|
|
|
|
wxString m_message_user; // (translated) a "detailed" message of what disastrous thing has occurred!
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
virtual ~BaseException() throw()=0; // the =0; syntax forces this class into "abstract" mode.
|
2009-04-27 02:04:31 +00:00
|
|
|
|
2009-09-01 00:43:28 +00:00
|
|
|
const wxString& DiagMsg() const { return m_message_diag; }
|
|
|
|
const wxString& UserMsg() const { return m_message_user; }
|
|
|
|
|
|
|
|
wxString& DiagMsg() { return m_message_diag; }
|
|
|
|
wxString& UserMsg() { return m_message_user; }
|
2009-04-27 02:04:31 +00:00
|
|
|
|
2010-08-06 05:46:09 +00:00
|
|
|
BaseException& SetBothMsgs( const wxChar* msg_diag );
|
2010-06-28 18:03:54 +00:00
|
|
|
BaseException& SetDiagMsg( const wxString& msg_diag );
|
|
|
|
BaseException& SetUserMsg( const wxString& msg_user );
|
|
|
|
|
2009-04-27 02:04:31 +00:00
|
|
|
// Returns a message suitable for diagnostic / logging purposes.
|
2009-09-01 00:43:28 +00:00
|
|
|
// This message is always in English, and includes a full stack trace.
|
|
|
|
virtual wxString FormatDiagnosticMessage() const;
|
2009-04-27 02:04:31 +00:00
|
|
|
|
|
|
|
// Returns a message suitable for end-user display.
|
|
|
|
// This message is usually meant for display in a user popup or such.
|
2010-06-28 18:03:54 +00:00
|
|
|
virtual wxString FormatDisplayMessage() const;
|
2009-10-19 01:50:52 +00:00
|
|
|
|
2009-09-29 19:16:00 +00:00
|
|
|
virtual void Rethrow() const=0;
|
|
|
|
virtual BaseException* Clone() const=0;
|
2009-02-09 21:15:56 +00:00
|
|
|
};
|
2009-09-13 20:56:22 +00:00
|
|
|
|
2016-01-27 17:50:51 +00:00
|
|
|
typedef std::unique_ptr<BaseException> ScopedExcept;
|
2010-10-18 01:40:49 +00:00
|
|
|
|
2009-09-13 17:11:35 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// Ps2Generic Exception
|
|
|
|
// --------------------------------------------------------------------------------------
|
2009-03-01 21:49:17 +00:00
|
|
|
// This class is used as a base exception for things tossed by PS2 cpus (EE, IOP, etc).
|
2009-09-01 00:43:28 +00:00
|
|
|
//
|
|
|
|
// Implementation note: does not derive from BaseException, so that we can use different
|
|
|
|
// catch block hierarchies to handle them (if needed).
|
|
|
|
//
|
|
|
|
// Translation Note: Currently these exceptions are never translated. English/diagnostic
|
|
|
|
// format only. :)
|
2009-04-27 02:04:31 +00:00
|
|
|
//
|
2009-08-31 03:47:05 +00:00
|
|
|
class Ps2Generic
|
2009-03-01 21:49:17 +00:00
|
|
|
{
|
2009-08-31 03:47:05 +00:00
|
|
|
protected:
|
2009-09-01 00:43:28 +00:00
|
|
|
wxString m_message; // a "detailed" message of what disastrous thing has occurred!
|
2009-08-31 03:47:05 +00:00
|
|
|
|
2009-03-01 21:49:17 +00:00
|
|
|
public:
|
|
|
|
virtual ~Ps2Generic() throw() {}
|
|
|
|
|
|
|
|
virtual u32 GetPc() const=0;
|
|
|
|
virtual bool IsDelaySlot() const=0;
|
2014-07-12 14:01:21 +00:00
|
|
|
virtual wxString& Message() { return m_message; }
|
2010-06-28 18:03:54 +00:00
|
|
|
|
|
|
|
virtual void Rethrow() const=0;
|
|
|
|
virtual Ps2Generic* Clone() const=0;
|
2009-03-01 21:49:17 +00:00
|
|
|
};
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2009-09-01 00:43:28 +00:00
|
|
|
// Some helper macros for defining the standard constructors of internationalized constructors
|
|
|
|
// Parameters:
|
|
|
|
// classname - Yeah, the name of this class being defined. :)
|
|
|
|
//
|
|
|
|
// defmsg - default message (in english), which will be used for both english and i18n messages.
|
|
|
|
// The text string will be passed through the translator, so if it's int he gettext database
|
|
|
|
// it will be optionally translated.
|
|
|
|
//
|
2010-05-03 13:51:46 +00:00
|
|
|
// BUGZ?? I'd rather use 'classname' on the Clone() prototype, but for some reason it generates
|
2010-06-28 18:03:54 +00:00
|
|
|
// ambiguity errors on virtual inheritance (it really shouldn't!). So I have to force it to the
|
2010-05-03 13:51:46 +00:00
|
|
|
// BaseException base class. Not sure if this is Stupid Standard Tricks or Stupid MSVC Tricks. --air
|
|
|
|
//
|
|
|
|
// (update: web searches indicate it's MSVC specific -- happens in 2008, not sure about 2010).
|
|
|
|
//
|
2010-06-28 18:03:54 +00:00
|
|
|
#define DEFINE_EXCEPTION_COPYTORS( classname, parent ) \
|
|
|
|
private: \
|
|
|
|
typedef parent _parent; \
|
|
|
|
public: \
|
2010-05-03 13:51:46 +00:00
|
|
|
virtual ~classname() throw() {} \
|
|
|
|
virtual void Rethrow() const { throw *this; } \
|
|
|
|
virtual classname* Clone() const { return new classname( *this ); }
|
2009-09-01 00:43:28 +00:00
|
|
|
|
2010-06-28 18:03:54 +00:00
|
|
|
#define DEFINE_EXCEPTION_MESSAGES( classname ) \
|
|
|
|
public: \
|
2010-08-06 05:46:09 +00:00
|
|
|
classname& SetBothMsgs( const wxChar* msg_diag ) { BaseException::SetBothMsgs(msg_diag); return *this; } \
|
2010-06-28 18:03:54 +00:00
|
|
|
classname& SetDiagMsg( const wxString& msg_diag ) { m_message_diag = msg_diag; return *this; } \
|
|
|
|
classname& SetUserMsg( const wxString& msg_user ) { m_message_user = msg_user; return *this; }
|
|
|
|
|
|
|
|
#define DEFINE_RUNTIME_EXCEPTION( classname, parent, message ) \
|
|
|
|
DEFINE_EXCEPTION_COPYTORS( classname, parent ) \
|
2010-08-06 05:46:09 +00:00
|
|
|
classname() { SetDiagMsg(message); } \
|
2010-06-28 18:03:54 +00:00
|
|
|
DEFINE_EXCEPTION_MESSAGES( classname )
|
|
|
|
|
|
|
|
|
2009-07-14 06:18:52 +00:00
|
|
|
// ---------------------------------------------------------------------------------------
|
2009-12-14 12:18:55 +00:00
|
|
|
// RuntimeError - Generalized Exceptions with Recoverable Traits!
|
2009-07-14 06:18:52 +00:00
|
|
|
// ---------------------------------------------------------------------------------------
|
|
|
|
|
2010-06-28 18:03:54 +00:00
|
|
|
class RuntimeError : public BaseException
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
2010-06-28 18:03:54 +00:00
|
|
|
DEFINE_EXCEPTION_COPYTORS( RuntimeError, BaseException )
|
|
|
|
DEFINE_EXCEPTION_MESSAGES( RuntimeError )
|
|
|
|
|
2009-10-07 19:20:11 +00:00
|
|
|
public:
|
|
|
|
bool IsSilent;
|
2010-04-27 13:12:03 +00:00
|
|
|
|
2010-06-28 18:03:54 +00:00
|
|
|
RuntimeError() { IsSilent = false; }
|
2010-04-27 13:12:03 +00:00
|
|
|
RuntimeError( const std::runtime_error& ex, const wxString& prefix=wxEmptyString );
|
2010-05-07 03:20:58 +00:00
|
|
|
RuntimeError( const std::exception& ex, const wxString& prefix=wxEmptyString );
|
2009-02-09 21:15:56 +00:00
|
|
|
};
|
|
|
|
|
2009-10-07 19:20:11 +00:00
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// CancelAppEvent - Exception for canceling an event in a non-verbose fashion
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// Typically the PCSX2 interface issues popup dialogs for runtime errors. This exception
|
|
|
|
// instead issues a "silent" cancelation that is handled by the app gracefully (generates
|
|
|
|
// log, and resumes messages queue processing).
|
|
|
|
//
|
2009-10-19 01:50:52 +00:00
|
|
|
// I chose to have this exception derive from RuntimeError, since if one is thrown from outside
|
2009-10-07 19:20:11 +00:00
|
|
|
// an App message loop we'll still want it to be handled in a reasonably graceful manner.
|
2010-06-28 18:03:54 +00:00
|
|
|
class CancelEvent : public RuntimeError
|
2009-10-07 19:20:11 +00:00
|
|
|
{
|
2010-12-14 07:28:05 +00:00
|
|
|
DEFINE_RUNTIME_EXCEPTION( CancelEvent, RuntimeError, pxLt("No reason given.") )
|
2009-10-07 19:20:11 +00:00
|
|
|
|
2010-06-28 18:03:54 +00:00
|
|
|
public:
|
|
|
|
explicit CancelEvent( const wxString& logmsg )
|
2009-10-07 19:20:11 +00:00
|
|
|
{
|
|
|
|
m_message_diag = logmsg;
|
|
|
|
// overridden message formatters only use the diagnostic version...
|
|
|
|
}
|
2009-10-19 01:50:52 +00:00
|
|
|
|
2009-10-07 19:20:11 +00:00
|
|
|
virtual wxString FormatDisplayMessage() const;
|
|
|
|
virtual wxString FormatDiagnosticMessage() const;
|
|
|
|
};
|
|
|
|
|
2010-06-28 18:03:54 +00:00
|
|
|
// ---------------------------------------------------------------------------------------
|
|
|
|
// OutOfMemory
|
|
|
|
// ---------------------------------------------------------------------------------------
|
|
|
|
// This exception has a custom-formatted Diagnostic string. The parameter give when constructing
|
|
|
|
// the exception is a block/alloc name, which is used as a formatting parameter in the diagnostic
|
|
|
|
// output. The default diagnostic message is "Out of memory exception, while allocating the %s."
|
|
|
|
// where %s is filled in with the block name.
|
|
|
|
//
|
|
|
|
// The user string is not custom-formatted, and should contain *NO* %s tags.
|
|
|
|
//
|
|
|
|
class OutOfMemory : public RuntimeError
|
2009-09-18 14:07:36 +00:00
|
|
|
{
|
2010-10-29 02:49:01 +00:00
|
|
|
DEFINE_RUNTIME_EXCEPTION( OutOfMemory, RuntimeError, wxEmptyString )
|
2009-09-18 14:07:36 +00:00
|
|
|
|
2010-06-28 18:03:54 +00:00
|
|
|
public:
|
|
|
|
wxString AllocDescription;
|
2009-09-18 14:07:36 +00:00
|
|
|
|
2010-06-28 18:03:54 +00:00
|
|
|
public:
|
|
|
|
OutOfMemory( const wxString& allocdesc );
|
2009-09-18 14:07:36 +00:00
|
|
|
|
|
|
|
virtual wxString FormatDisplayMessage() const;
|
|
|
|
virtual wxString FormatDiagnosticMessage() const;
|
|
|
|
};
|
|
|
|
|
2009-04-02 11:30:23 +00:00
|
|
|
class ParseError : public RuntimeError
|
|
|
|
{
|
2010-12-14 07:28:05 +00:00
|
|
|
DEFINE_RUNTIME_EXCEPTION( ParseError, RuntimeError, pxL("Parse error") );
|
2009-09-13 20:56:22 +00:00
|
|
|
};
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2009-07-14 06:18:52 +00:00
|
|
|
// ---------------------------------------------------------------------------------------
|
|
|
|
// Hardware/OS Exceptions:
|
2009-12-07 14:00:39 +00:00
|
|
|
// HardwareDeficiency / VirtualMemoryMapConflict
|
2009-07-14 06:18:52 +00:00
|
|
|
// ---------------------------------------------------------------------------------------
|
|
|
|
|
2009-12-07 14:00:39 +00:00
|
|
|
// This exception is a specific type of OutOfMemory error that isn't "really" an out of
|
|
|
|
// memory error. More likely it's caused by a plugin or driver reserving a range of memory
|
|
|
|
// we'd really like to have access to.
|
2010-06-28 18:03:54 +00:00
|
|
|
class VirtualMemoryMapConflict : public OutOfMemory
|
2009-12-07 14:00:39 +00:00
|
|
|
{
|
2010-10-29 02:49:01 +00:00
|
|
|
DEFINE_RUNTIME_EXCEPTION( VirtualMemoryMapConflict, OutOfMemory, wxEmptyString )
|
|
|
|
|
|
|
|
VirtualMemoryMapConflict( const wxString& allocdesc );
|
|
|
|
|
|
|
|
virtual wxString FormatDisplayMessage() const;
|
|
|
|
virtual wxString FormatDiagnosticMessage() const;
|
2009-12-07 14:00:39 +00:00
|
|
|
};
|
|
|
|
|
2010-06-28 18:03:54 +00:00
|
|
|
class HardwareDeficiency : public RuntimeError
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
|
|
|
public:
|
2010-12-14 07:28:05 +00:00
|
|
|
DEFINE_RUNTIME_EXCEPTION( HardwareDeficiency, RuntimeError, pxL("Your machine's hardware is incapable of running PCSX2. Sorry dood.") );
|
2009-02-09 21:15:56 +00:00
|
|
|
};
|
|
|
|
|
2009-07-14 06:18:52 +00:00
|
|
|
// ---------------------------------------------------------------------------------------
|
|
|
|
// Streaming (file) Exceptions:
|
2010-04-27 13:12:03 +00:00
|
|
|
// Stream / BadStream / CannotCreateStream / FileNotFound / AccessDenied / EndOfStream
|
2009-07-14 06:18:52 +00:00
|
|
|
// ---------------------------------------------------------------------------------------
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2010-06-28 18:03:54 +00:00
|
|
|
#define DEFINE_STREAM_EXCEPTION_ACCESSORS( classname ) \
|
|
|
|
virtual classname& SetStreamName( const wxString& name ) { StreamName = name; return *this; } \
|
|
|
|
virtual classname& SetStreamName( const char* name ) { StreamName = fromUTF8(name); return *this; }
|
|
|
|
|
2010-11-05 01:33:01 +00:00
|
|
|
#define DEFINE_STREAM_EXCEPTION( classname, parent ) \
|
|
|
|
DEFINE_RUNTIME_EXCEPTION( classname, parent, wxEmptyString ) \
|
2010-06-28 18:03:54 +00:00
|
|
|
classname( const wxString& filename ) { \
|
|
|
|
StreamName = filename; \
|
|
|
|
} \
|
|
|
|
DEFINE_STREAM_EXCEPTION_ACCESSORS( classname )
|
|
|
|
|
2010-11-05 01:33:01 +00:00
|
|
|
// A generic base error class for bad streams -- corrupted data, sudden closures, loss of
|
|
|
|
// connection, or anything else that would indicate a failure to open a stream or read the
|
|
|
|
// data after the stream was successfully opened.
|
2009-07-14 06:18:52 +00:00
|
|
|
//
|
2010-11-05 01:33:01 +00:00
|
|
|
class BadStream : public RuntimeError
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
2010-11-05 01:33:01 +00:00
|
|
|
DEFINE_STREAM_EXCEPTION( BadStream, RuntimeError )
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2009-09-01 00:43:28 +00:00
|
|
|
public:
|
2010-06-28 18:03:54 +00:00
|
|
|
wxString StreamName; // name of the stream (if applicable)
|
2009-09-01 00:43:28 +00:00
|
|
|
|
|
|
|
virtual wxString FormatDiagnosticMessage() const;
|
|
|
|
virtual wxString FormatDisplayMessage() const;
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2010-11-05 01:33:01 +00:00
|
|
|
protected:
|
|
|
|
void _formatDiagMsg( FastFormatUnicode& dest ) const;
|
|
|
|
void _formatUserMsg( FastFormatUnicode& dest ) const;
|
2009-02-09 21:15:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// A generic exception for odd-ball stream creation errors.
|
2009-07-14 06:18:52 +00:00
|
|
|
//
|
2010-11-05 01:33:01 +00:00
|
|
|
class CannotCreateStream : public BadStream
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
2010-11-05 01:33:01 +00:00
|
|
|
DEFINE_STREAM_EXCEPTION( CannotCreateStream, BadStream )
|
|
|
|
|
|
|
|
virtual wxString FormatDiagnosticMessage() const;
|
|
|
|
virtual wxString FormatDisplayMessage() const;
|
2009-02-09 21:15:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Exception thrown when an attempt to open a non-existent file is made.
|
|
|
|
// (this exception can also mean file permissions are invalid)
|
2009-07-14 06:18:52 +00:00
|
|
|
//
|
2010-06-28 18:03:54 +00:00
|
|
|
class FileNotFound : public CannotCreateStream
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
|
|
|
public:
|
2010-11-05 01:33:01 +00:00
|
|
|
DEFINE_STREAM_EXCEPTION( FileNotFound, CannotCreateStream )
|
|
|
|
|
|
|
|
virtual wxString FormatDiagnosticMessage() const;
|
|
|
|
virtual wxString FormatDisplayMessage() const;
|
2009-02-09 21:15:56 +00:00
|
|
|
};
|
|
|
|
|
2010-06-28 18:03:54 +00:00
|
|
|
class AccessDenied : public CannotCreateStream
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
|
|
|
public:
|
2010-11-05 01:33:01 +00:00
|
|
|
DEFINE_STREAM_EXCEPTION( AccessDenied, CannotCreateStream )
|
|
|
|
|
|
|
|
virtual wxString FormatDiagnosticMessage() const;
|
|
|
|
virtual wxString FormatDisplayMessage() const;
|
2009-02-09 21:15:56 +00:00
|
|
|
};
|
|
|
|
|
2009-07-14 06:18:52 +00:00
|
|
|
// EndOfStream can be used either as an error, or used just as a shortcut for manual
|
|
|
|
// feof checks.
|
|
|
|
//
|
2010-11-05 01:33:01 +00:00
|
|
|
class EndOfStream : public BadStream
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
|
|
|
public:
|
2010-11-05 01:33:01 +00:00
|
|
|
DEFINE_STREAM_EXCEPTION( EndOfStream, BadStream )
|
|
|
|
|
|
|
|
virtual wxString FormatDiagnosticMessage() const;
|
|
|
|
virtual wxString FormatDisplayMessage() const;
|
2009-02-09 21:15:56 +00:00
|
|
|
};
|
2010-01-25 15:31:17 +00:00
|
|
|
|
|
|
|
#ifdef __WXMSW__
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// Exception::WinApiError
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
class WinApiError : public RuntimeError
|
|
|
|
{
|
2010-06-28 18:03:54 +00:00
|
|
|
DEFINE_EXCEPTION_COPYTORS( WinApiError, RuntimeError )
|
|
|
|
DEFINE_EXCEPTION_MESSAGES( WinApiError )
|
|
|
|
|
2010-01-25 15:31:17 +00:00
|
|
|
public:
|
|
|
|
int ErrorId;
|
|
|
|
|
|
|
|
public:
|
2010-06-28 18:03:54 +00:00
|
|
|
WinApiError();
|
2010-01-25 15:31:17 +00:00
|
|
|
|
|
|
|
wxString GetMsgFromWindows() const;
|
|
|
|
virtual wxString FormatDisplayMessage() const;
|
|
|
|
virtual wxString FormatDiagnosticMessage() const;
|
|
|
|
};
|
|
|
|
#endif
|
2009-02-09 21:15:56 +00:00
|
|
|
}
|
2010-04-27 13:12:03 +00:00
|
|
|
|
|
|
|
using Exception::BaseException;
|
2010-10-18 01:40:49 +00:00
|
|
|
using Exception::ScopedExcept;
|