More usable error messages when exceptions are not caught

Subject: More usable error messages when exceptions are not caught

Date: Fri, 02 Dec 2022 20:05:02 +0100

To: notmuch@notmuchmail.org

Cc:

From: Thomas Schneider


Hi,

it would be nice if the error message notmuch shows when an uncaught
exception occurs was more helpful to the user.  It could at least show
the exception message (`e->what()` iirc), which would have helped in
this case.

From IRC:

<qsx> % notmuch new
<qsx> libc++abi: terminating due to uncaught exception of type Xapian::DatabaseError
<qsx> fun
<qsx> does this sound interesting enough to build notmuch and xapian with debug symbols?
[…]
<qsx> but i think the issue is that there’s no space left on the filesystem where the xapian db lives
[…]
<qsx> sounds reasonable
<qsx> but i think it would be nicer for the user if notmuch at least showed the message of the exception, because that was some work to get to this point

Backtrace:

(gdb) p *(Xapian::DatabaseError *)thrown_object
$13 = {<Xapian::RuntimeError> = {<Xapian::Error> = {msg = {static __endian_factor = 2, 
        __r_ = {<std::__1::__compressed_pair_elem<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__rep, 0, false>> = {__value_ = {{__l = {{__is_long_ = 1, __cap_ = 16}, 
                  __size_ = 25, __data_ = 0x555582cd4fc0 "Error writing block 83232"}, __s = {{__is_long_ = 1 '\001', __size_ = 16 '\020'}, __padding_ = 0x555555c15e61 "", 
                  __data_ = "\000\000\000\000\000\000\000\031\000\000\000\000\000\000\000\300O͂UU\000"}, __r = {__words = {33, 25, 
                    93825755074496}}}}}, <std::__1::__compressed_pair_elem<std::__1::allocator<char>, 1, true>> = {<std::__1::allocator<char>> = {<std::__1::__non_trivial_if<true, std::__1::allocator<char> >> = {<No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, static npos = 18446744073709551615}, context = {static __endian_factor = 2, 
        __r_ = {<std::__1::__compressed_pair_elem<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__rep, 0, false>> = {__value_ = {{__l = {{__is_long_ = 0, __cap_ = 0}, 
                  __size_ = 0, __data_ = 0x0}, __s = {{__is_long_ = 0 '\000', __size_ = 0 '\000'}, __padding_ = 0x555555c15e79 "", __data_ = '\000' <repeats 22 times>}, __r = {__words = {0, 0, 
                    0}}}}}, <std::__1::__compressed_pair_elem<std::__1::allocator<char>, 1, true>> = {<std::__1::allocator<char>> = {<std::__1::__non_trivial_if<true, std::__1::allocator<char> >> = {<No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, static npos = 18446744073709551615}, error_string = {static __endian_factor = 2, 
        __r_ = {<std::__1::__compressed_pair_elem<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__rep, 0, false>> = {__value_ = {{__l = {{__is_long_ = 0, __cap_ = 0}, 
                  __size_ = 0, __data_ = 0x0}, __s = {{__is_long_ = 0 '\000', __size_ = 0 '\000'}, __padding_ = 0x555555c15e91 "", __data_ = '\000' <repeats 22 times>}, __r = {__words = {0, 0, 
                    0}}}}}, <std::__1::__compressed_pair_elem<std::__1::allocator<char>, 1, true>> = {<std::__1::allocator<char>> = {<std::__1::__non_trivial_if<true, std::__1::allocator<char> >> = {<No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, static npos = 18446744073709551615}, type = 0x7ffff797410c <str.17.llvm> "\004DatabaseError", my_errno = 28, 
      already_handled = false}, <No data fields>}, <No data fields>}

	--qsx
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: