aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--odb/mysql/error.cxx12
1 files changed, 9 insertions, 3 deletions
diff --git a/odb/mysql/error.cxx b/odb/mysql/error.cxx
index b439d23..81990ad 100644
--- a/odb/mysql/error.cxx
+++ b/odb/mysql/error.cxx
@@ -15,11 +15,11 @@ namespace odb
{
namespace mysql
{
- void
+ static void
translate_error (connection& c,
unsigned int e,
const string& sqlstate,
- const string& message)
+ string msg)
{
switch (e)
{
@@ -44,7 +44,13 @@ namespace odb
}
default:
{
- throw database_exception (e, sqlstate, message);
+ // Get rid of a trailing newline if there is one.
+ //
+ string::size_type n (msg.size ());
+ if (n != 0 && msg[n - 1] == '\n')
+ msg.resize (n - 1);
+
+ throw database_exception (e, sqlstate, msg);
}
}
}