|
|
| <prev next> |
Choosing A Webhost: |
CVS update of carob (include/CarobException.hpp src/CarobException.cpp): msg#00117db.carob.cvs
Date: Tuesday, February 28, 2006 @ 19:50:41 Author: marc Path: /cvsroot/carob/carob Modified: include/CarobException.hpp (1.36 -> 1.37) src/CarobException.cpp (1.19 -> 1.20) Modified constructors to ease setting the SQLState. Now only one constructor with default arguments available. ----------------------------+ include/CarobException.hpp | 54 +++++++++++++++++++++++++++++++------------ src/CarobException.cpp | 13 ++-------- 2 files changed, 43 insertions(+), 24 deletions(-) Index: carob/include/CarobException.hpp diff -u carob/include/CarobException.hpp:1.36 carob/include/CarobException.hpp:1.37 --- carob/include/CarobException.hpp:1.36 Tue Feb 28 17:58:14 2006 +++ carob/include/CarobException.hpp Tue Feb 28 19:50:41 2006 @@ -25,6 +25,10 @@ #include <string> #include <vector> +namespace { + const int DEFAULTVENDORCODE(-1); + const std::wstring DEFAULTSQLSTATE(L"HY000"); +} namespace CarobNS { @@ -53,10 +57,6 @@ */ CarobException(const CarobException& ce); /** - * Constructs a simple Exception with a message string - */ - CarobException(std::wstring s) : message(s), causePtr(NULL) {}; - /** * Constructs/reads a new Exception chain from the stream * @param sock socket from which to deserialize exception * @throw SocketIOException. Not specified in method signature because of @@ -70,10 +70,20 @@ * <code>cause</code> is <i>not</i> automatically incorporated in * this exception's detail message. * - * @param message the detail message - * @param cause the exception that generated this one - */ - CarobException(const std::wstring& message, CarobException* cause); + * @param messagePrm the detailed user-friendly message + * @param SQLStatePrm the SQL2 standard error code. + * @param causePrm the exception that generated this one, if any. + * @param vendorPrm the (deprecated) SQL1 error code + */ + CarobException(const std::wstring& messagePrm, + const std::wstring& SQLStatePrm = DEFAULTSQLSTATE, + CarobException* causePrm = 0, + int vendorPrm = DEFAULTVENDORCODE) : + message(messagePrm), + causePtr(causePrm), + SQLState(SQLStatePrm), + errorCode(vendorPrm) + { } /** * Destructor to clean up stack trace and cause exception */ @@ -103,9 +113,9 @@ StackTrace stackTrace; /** pointer to the exception that generated this one */ CarobException* causePtr; - /** SQL error message */ + /** SQL2 standard error code */ std::wstring SQLState; - /** Vendor-specific error code */ + /** Deprecated SQL1 "standard" error code. Negative for errors, positive for warnings. */ int errorCode; /** Local stack trace when available */ const BackTrace backTrace; @@ -144,9 +154,18 @@ public: /** * Constructs a DriverException with the given message - * @param s error message of the exception - */ - DriverException(std::wstring s) : CarobException(s) {}; + * + * @param messagePrm the detailed user-friendly message + * @param SQLStatePrm the SQL2 standard error code. + * @param causePrm the exception that generated this one, if any. + * @param vendorPrm the (deprecated) SQL1 error code + */ + DriverException(const std::wstring& messagePrm, + const std::wstring& SQLStatePrm = DEFAULTSQLSTATE, + CarobException* causePrm = 0, + int vendorPrm = DEFAULTVENDORCODE) : + CarobException(messagePrm, SQLStatePrm, causePrm, vendorPrm) + { } }; /** @@ -198,7 +217,7 @@ * Constructs a AuthenticationException with the given message * @param s error message of the exception */ - AuthenticationException(std::wstring s) : DriverException(s) {}; + AuthenticationException(std::wstring s) : DriverException(s, L"28000") {} }; /** @@ -339,3 +358,10 @@ #endif //_CAROBEXCEPTION_H_ +/* + * Local Variables: + * c-file-style: "bsd" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * End: + */ Index: carob/src/CarobException.cpp diff -u carob/src/CarobException.cpp:1.19 carob/src/CarobException.cpp:1.20 --- carob/src/CarobException.cpp:1.19 Mon Jan 30 12:09:30 2006 +++ carob/src/CarobException.cpp Tue Feb 28 19:50:41 2006 @@ -16,7 +16,7 @@ * limitations under the License. * * Initial developer(s): Gilles Rayrat - * Contributor(s): + * Contributor(s): Marc Herbert */ #include "CarobException.hpp" @@ -59,6 +59,7 @@ } } +/** Copy constructor */ CarobException::CarobException(const CarobException& ce) : message(ce.message), stackTrace(ce.stackTrace), @@ -67,7 +68,7 @@ backTrace(ce.backTrace) { if (ce.causePtr != NULL) - { + { // copy chain by recursively calling copy constructor causePtr = new CarobException(*(ce.causePtr)); } else @@ -97,14 +98,6 @@ sock>>SQLState; sock>>errorCode; } - -CarobException::CarobException(const wstring &messagePrm, - CarobException* causePrm) -{ - message = messagePrm; - causePtr = causePrm; -} - void UnexpectedException::convertUnexpected() { if (isErrorEnabled())
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | CVS update of carob/include (CarobException.hpp), marc-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
|---|---|
| Previous by Thread: | CVS update of carob/include (CarobException.hpp), marc-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |
Home
| advertise | OSDir is
an inevitable website.
|