summaryrefslogtreecommitdiff
path: root/exception.c
diff options
context:
space:
mode:
authorBert Vermeulen <bert@biot.com>2014-07-08 21:43:33 +0200
committerBert Vermeulen <bert@biot.com>2014-07-08 21:46:10 +0200
commit84d7ecb947a8a6453fc0cb1d7973a821615dec54 (patch)
tree3c6f0f17206f75172a1afee06e815ae4a33cf3b1 /exception.c
parentf6c7eade2b8853b3d525b5cc0402e89ca74c1908 (diff)
downloadlibsigrokdecode-84d7ecb947a8a6453fc0cb1d7973a821615dec54.tar.gz
libsigrokdecode-84d7ecb947a8a6453fc0cb1d7973a821615dec54.zip
Make exception output more predictable.
Diffstat (limited to 'exception.c')
-rw-r--r--exception.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/exception.c b/exception.c
index 9c3fa48..8f15ff2 100644
--- a/exception.c
+++ b/exception.c
@@ -46,21 +46,20 @@ SRD_PRIV void srd_exception_catch(const char *format, ...)
return;
}
- msg = g_string_sized_new(128);
- va_start(args, format);
- g_string_vprintf(msg, format, args);
- va_end(args);
-
- /* Can be NULL. */
+ /* Send the exception error message(s) to srd_err(). */
if (evalue)
ename = (char *)Py_TYPE(evalue)->tp_name;
else
+ /* Can be NULL. */
ename = "(unknown exception)";
- /* Send the exception error message(s) to srd_err(). */
- py_str_as_str(py_str, &str);
+ msg = g_string_sized_new(128);
g_string_append(msg, ename);
g_string_append(msg, ": ");
+ va_start(args, format);
+ g_string_append_vprintf(msg, format, args);
+ va_end(args);
+ py_str_as_str(py_str, &str);
g_string_append(msg, str);
Py_DecRef(py_str);
srd_err(msg->str);