summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--TODO9
-rw-r--r--sbuild/sbuild-util.cc5
3 files changed, 12 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index e5d3106c..9fe68a4e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2006-06-28 Roger Leigh <rleigh@debian.org>
+ * TODO: Remove completed item.
+
+ * sbuild/sbuild-util.cc (narrow_string, widen_string): Throw a
+ runtime_error on conversion failure.
+
+2006-06-28 Roger Leigh <rleigh@debian.org>
+
* sbuild/sbuild-auth.cc: Fix switched authentication and
authorisation messages.
diff --git a/TODO b/TODO
index 740dab9f..229da789 100644
--- a/TODO
+++ b/TODO
@@ -17,15 +17,6 @@ PENDING
the boost::format markup changes fixing first. What are other
projects doing?
-* Handle charset conversion errors more gracefully.
-
- sbuild-util widen_string and narrow_string. Currently an error
- occurs if in a C locale the string contains non-US-ASCII characters
- or, in other locales if the gettext message catalogue has bad
- strings. The string is truncated to the point of error, or may be
- empty depending where the error is. We should error out a bit
- better in this case. Assertion, or exception?
-
* Use boost::format markup in the standard error strings.
This will complete the i18n support for error translation. It will
diff --git a/sbuild/sbuild-util.cc b/sbuild/sbuild-util.cc
index a6b1ab20..4c1daf9e 100644
--- a/sbuild/sbuild-util.cc
+++ b/sbuild/sbuild-util.cc
@@ -19,6 +19,7 @@
#include <config.h>
+#include "sbuild-error.h"
#include "sbuild-util.h"
#include <sys/types.h>
@@ -206,6 +207,8 @@ sbuild::widen_string (std::string const& str,
}
else if (res == std::codecvt_base::error)
{
+ throw runtime_error
+ ("A character set conversion failed. Please report this bug.");
break;
}
else
@@ -251,6 +254,8 @@ sbuild::narrow_string (std::wstring const& str,
}
else if (res == std::codecvt_base::error)
{
+ throw runtime_error
+ ("A character set conversion failed. Please report this bug.");
break;
}
else