5 * ---------------------------------------------------------------------------
7 * Implementation of a minimal C++ class framework for use with the
8 * Microsoft Windows Application Programming Interface.
12 * This header file declares the exception class WTK::runtime_error.
13 * It is implicitly included when including wtkplus.h, but may also be
14 * explicitly included by any application which wishes to use the WTK
15 * exception class, without the rest of the WTK C++ class framework.
17 * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
18 * Copyright (C) 2012, MinGW.org Project.
20 * Based on the implementation of mingw-get's dmh_exception class
21 * Originally written by Charles Wilson <cwilso11@users.sourceforge.net>
23 * ---------------------------------------------------------------------------
25 * Permission is hereby granted, free of charge, to any person obtaining a
26 * copy of this software and associated documentation files (the "Software"),
27 * to deal in the Software without restriction, including without limitation
28 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
29 * and/or sell copies of the Software, and to permit persons to whom the
30 * Software is furnished to do so, subject to the following conditions:
32 * The above copyright notice and this permission notice shall be included
33 * in all copies or substantial portions of the Software.
35 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
36 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
38 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
40 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
41 * DEALINGS IN THE SOFTWARE.
43 * ---------------------------------------------------------------------------
52 class runtime_error: public std::exception
54 /* An exception class, similar to std::runtime_error, but using
55 * a "const char *" rather than a "std::string" to categorise and
56 * describe the exception.
59 runtime_error() throw();
60 runtime_error( const char * ) throw();
61 virtual const char *what() const throw();
62 virtual ~runtime_error() throw(){}
70 /* A helper class to dynamically place message text, up to a
71 * maximum of 256 characters, into a static buffer whence it
72 * may be retrieved on catching a runtime_error exception.
75 error_text( const char *, ... ) throw();
76 operator const char *() const throw(){ return message; }
79 static char message[256];
83 #endif /* ! WTKEXCEPT_H: $RCSfile$: end of file */