aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2014-11-25 08:53:16 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2014-11-25 08:53:16 +0200
commit5031f119479be1cb7a3880535ccdd76ccdcf330b (patch)
treeafdac37dbf4c6ee2d7be1b39bb0a101e6c789bd8
parent9cbf27d6de0b868c4c21a4d58e10a906a47f4d92 (diff)
Get rid of trailing newlines in error messages
-rw-r--r--odb/sqlite/error.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/odb/sqlite/error.cxx b/odb/sqlite/error.cxx
index 6107427..6fae9d5 100644
--- a/odb/sqlite/error.cxx
+++ b/odb/sqlite/error.cxx
@@ -83,6 +83,12 @@ namespace odb
if (m.empty ())
m = sqlite3_errmsg (h);
+ // Get rid of a trailing newline if there is one.
+ //
+ string::size_type n (m.size ());
+ if (n != 0 && m[n - 1] == '\n')
+ m.resize (n - 1);
+
throw database_exception (e, ee, m);
}
}