Author: wyoung
Date: Fri Jun 22 23:15:51 2007
New Revision: 1595

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1595&view=rev
Log:
Fixed handling of BadConversion exception.  Was passing an error string
where we should have been passing a type name.  Exception object
constructs the error string from that now, instead of leaving that up to
the caller.

Modified:
    trunk/lib/coldata.h
    trunk/lib/exceptions.h

Modified: trunk/lib/coldata.h
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/coldata.h?rev=1595&r1=1594&r2=1595&view=diff
==============================================================================
--- trunk/lib/coldata.h (original)
+++ trunk/lib/coldata.h Fri Jun 22 23:15:51 2007
@@ -339,10 +339,7 @@
        }
        
        if (*end != '\0' && end != 0) {
-               std::ostringstream outs;
-               outs << "Tried to convert \"" << *this << "\" to a \"" <<
-                               typeid(Type).name() << "\" object." << 
std::ends;
-               throw BadConversion(outs.str().c_str(), Str::c_str(),
+               throw BadConversion(typeid(Type).name(), Str::c_str(),
                                end - str, len);
        }
 

Modified: trunk/lib/exceptions.h
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/exceptions.h?rev=1595&r1=1594&r2=1595&view=diff
==============================================================================
--- trunk/lib/exceptions.h (original)
+++ trunk/lib/exceptions.h Fri Jun 22 23:15:51 2007
@@ -103,13 +103,16 @@
        /// \param a ??
        BadConversion(const char* tn, const char* d,
                        size_t r, size_t a) :
-       Exception(std::string("Bad type conversion: ") +
-                       std::string(d ? d : "<NULL>")),
+       Exception("Bad type conversion: \""),
        type_name(tn),
        data(d),
        retrieved(r),
        actual_size(a)
        {
+               what_ += d ? d : "<NULL>";
+               what_ += "\" incompatible with \"";
+               what_ += tn;
+               what_ += "\" type";
        }
 
        /// \brief Create exception object, given completed error string


_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits

Reply via email to