File indexing completed on 2024-05-12 17:16:24

0001 /*
0002  * Port for usage with qt-framework and development for kdesvn
0003  * Copyright (C) 2005-2009 by Rajko Albrecht (ral@alwins-world.de)
0004  * http://kdesvn.alwins-world.de
0005  */
0006 /*
0007  * ====================================================================
0008  * Copyright (c) 2002-2005 The RapidSvn Group.  All rights reserved.
0009  * dev@rapidsvn.tigris.org
0010  *
0011  * This library is free software; you can redistribute it and/or
0012  * modify it under the terms of the GNU Lesser General Public
0013  * License as published by the Free Software Foundation; either
0014  * version 2.1 of the License, or (at your option) any later version.
0015  *
0016  * This library is distributed in the hope that it will be useful,
0017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0019  * Lesser General Public License for more details.
0020  *
0021  * You should have received a copy of the GNU Lesser General Public
0022  * License along with this library (in the file LGPL.txt); if not,
0023  * write to the Free Software Foundation, Inc., 51 Franklin St,
0024  * Fifth Floor, Boston, MA  02110-1301  USA
0025  *
0026  * This software consists of voluntary contributions made by many
0027  * individuals.  For exact contribution history, see the revision
0028  * history and logs, available at http://rapidsvn.tigris.org/.
0029  * ====================================================================
0030  */
0031 
0032 #ifndef SVNQT_EXCEPTION_H
0033 #define SVNQT_EXCEPTION_H
0034 
0035 #include <svnqt/svnqt_defines.h>
0036 
0037 // subversion api
0038 #include <svn_client.h>
0039 #include <QString>
0040 
0041 namespace svn
0042 {
0043 
0044 /**
0045  * Generic exception class.
0046  */
0047 class SVNQT_EXPORT Exception
0048 {
0049 public:
0050     /**
0051      * Constructor.  Assigns the exception reason.
0052      */
0053     explicit Exception(const char *message) throw ();
0054     explicit Exception(const QString &message) throw();
0055 
0056     virtual ~Exception() throw ();
0057 
0058     /**
0059      * @return the exception message.
0060      */
0061     virtual const QString &msg() const;
0062 
0063     /**
0064      * @return the outermost error code.
0065      */
0066     apr_status_t apr_err() const;
0067 
0068     static QString error2msg(svn_error_t *error);
0069 
0070 protected:
0071     struct Data;
0072     Data *m;
0073     void setMessage(const QString &);
0074 
0075 private:
0076 
0077     Exception(const Exception &) throw ();
0078 
0079     Exception() throw ();
0080 
0081     Exception &operator = (const Exception &);
0082 
0083 };
0084 
0085 /**
0086  * Subversion client exception class.
0087  */
0088 class SVNQT_EXPORT ClientException : public Exception
0089 {
0090 public:
0091     /**
0092      * Constructor.  Sets the error template and an optional message.
0093      * @param error the error to display. This will get cleared inside with svn_error_clear
0094      * so it isn't usable after that!
0095      */
0096     explicit ClientException(svn_error_t *error) throw ();
0097 
0098     /**
0099      * Constructor that takes only an apr errorcode
0100      */
0101     explicit ClientException(apr_status_t status) throw ();
0102 
0103     /**
0104      * Constructor
0105      */
0106     explicit ClientException(const char *msg) throw ();
0107 
0108     /**
0109      * Constructor
0110      */
0111     explicit ClientException(const QString &message) throw();
0112 
0113     /**
0114      * Copy constructor
0115      */
0116     ClientException(const ClientException &src) throw ();
0117 
0118     virtual ~ClientException() throw ();
0119 
0120 private:
0121     ClientException() throw ();
0122 
0123     ClientException &operator = (ClientException &);
0124     static QString getBackTrace();
0125 
0126     void init();
0127     /// backtrace from constructor;
0128     QString m_backTraceConstr;
0129 
0130 };
0131 
0132 }
0133 
0134 #endif
0135 /* -----------------------------------------------------------------
0136  * local variables:
0137  * eval: (load-file "../../rapidsvn-dev.el")
0138  * end:
0139  */