home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / oclsrc15.zip / OCL / Include / OPMException.hpp < prev    next >
C/C++ Source or Header  |  1996-08-12  |  3KB  |  99 lines

  1. // OCL - OS/2 Class Library
  2. // (c) Cubus 1995
  3. // All Rights Reserved
  4. // OPMException.hpp
  5.  
  6. /*
  7.  * Redistribution and use in source and binary forms, with or without
  8.  * modification, are permitted provided that the following conditions
  9.  * are met:
  10.  * 1. Redistributions of source code must retain the above copyright
  11.  *    notice, this list of conditions and the following disclaimer.
  12.  * 2. Neither the name Cubus nor the name Team OCL may be used to
  13.  *    endorse or promote products derived from this software
  14.  *    without specific prior written permission.
  15.  * 3. See OCL.INF for a detailed copyright notice.
  16.  *
  17.  *              THIS SOFTWARE IS PROVIDED ``AS IS'' AND
  18.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  19.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  20.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  21.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  22.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  23.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  24.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  25.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  26.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  27.  * SUCH DAMAGE.
  28.  */
  29.  
  30. // $Header: W:/Projects/OCL/Include/rcs/OPMException.hpp 1.50 1996/08/11 23:47:24 B.STEIN Release $
  31.  
  32. #ifndef OPMEXCEPTION_INCLUDED
  33.   #define OPMEXCEPTION_INCLUDED
  34.  
  35.  
  36. #ifndef OEXCEPTION_INCLUDED
  37.   #include <OException.hpp>
  38. #endif
  39.  
  40. #ifndef OAPP_INCLUDED
  41.  #include <OApp.hpp>
  42. #endif
  43.  
  44. #ifndef OMSGS_INCLUDED
  45.  #include <OMsgs.hpp>
  46. #endif
  47.  
  48. #ifndef OMESSAGE_INCLUDED
  49.  #include <OMessage.hpp>
  50. #endif
  51.  
  52.  
  53. typedef class OPMException *pOPMException;
  54.  
  55.  
  56. class __CPP_EXPORT__ OPMException 
  57.   : public OException
  58. {
  59.  public:
  60.    OMsgs             exMsg; 
  61.    OString           message;
  62.    ULONG             errRes;
  63.  
  64.  
  65.    OPMException     (const PSZ err,                     // supplied error message
  66.                      const ULONG retcode = 0,           // an API return code
  67.                      const ULONG severity = OException::unrecoverable,
  68.                      const PSZ source = "",             // module name
  69.                      const ULONG line = 0);             // source code line
  70.  
  71.    OPMException     (const ULONG errResource,           // resource id in stringtable
  72.                      const ULONG retcode = 0,           // an API return code
  73.                      const ULONG severity = OException::unrecoverable,
  74.                      const HMODULE mod = NULLHANDLE,    // module to load errResource from
  75.                      const PSZ source = "",             // module name
  76.                      const ULONG line = 0);             // source code line
  77.  
  78.    OPMException     (const OPMException& ex);
  79.  
  80.  
  81.    virtual
  82.       ~OPMException ();
  83.  
  84.    virtual
  85.       PSZ isOfType  () const;
  86.  
  87.    virtual void
  88.       viewError     (); // error box with formatted error message
  89. };
  90.  
  91.  
  92. #define OThrowPM(a, b, c) (throw OPMException(a, b, c, __FILE__, __LINE__));
  93.  
  94.  
  95. #endif // OPMEXCEPTION_INCLUDED
  96.  
  97.  
  98. // end of source
  99.