Re: Handling utf8 data from SQLite

On Sun, 11 Sep 2011 07:34:25 +1000
Zettai Muri <zettaimuri gmail com> wrote:
> >>
> >> try {
> >>  std::cout << "DB - Password: " << password << std::endl;
> >> }
> >> catch (Glib::Exception& e) {
> >>  std::cerr << e.what().raw() << std::endl;
> >> }
> >> catch (std::exception& e) {
> >>  std::cerr << e.what() << std::endl;
> >> }
> >>
> Mmm I added this to my code and it continues to print out the same
> error without appearing to catch the exception.  I changed in the
> above code std::cerr to std::cout because on WinXP std::cerr doesn't
> go to the terminal.  However I continue to only get:
> (Japanese01.exe:2428): glibmm-CRITICAL **:
> unhandled exception (type Glib::Error) in signal handler:
> domain: g_convert_error
> code  : 1
> what  : Invalid byte sequence in conversion input
> It doesn't look like it is being caught here.  So I suppose this means
> the error is being thrown somewhere else? Perhaps in the 'signal
> handler'? Where would I find this?

You said that the problem disappears if you comment out the line in the
try block, or if you pass password.raw() rather than password to
operator<<().   If that remains the case then you must have
mistyped the code in the try/catch block, tested it wrongly, or your
compiler is broken, since according to the glibmm documentation
Glib::Error inherits from Glib::Exception so it has to be caught by
the first catch block.

Assuming that that is what is throwing, it is the findPassword() method
which throws because that is the function within which the throwing
code is situated. That is called by the on_find_button_clicked() signal
callback, so presumably that is the signal handler concerned.
(Exceptions propagate through the stack if not caught until they hit
the underlying GTK+ C layer, at which point the gtkmm wrapper will
catch the exception and print the critical error message you are


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]