From fc9dc080455025f16c2ef58d14d8b16913eeb999 Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Thu, 20 Mar 2014 17:26:44 +0100 Subject: [PATCH] oc-sogo: pretty print Exceptions in sogo_backend_handle_objc_exception() Now we have a nice stack trace printed out from [NSException callStackSymbols] Signed-off-by: Kamen Mazdrashki --- OpenChange/MAPIStoreSOGo.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/OpenChange/MAPIStoreSOGo.m b/OpenChange/MAPIStoreSOGo.m index 73872db7e..7d52151c6 100644 --- a/OpenChange/MAPIStoreSOGo.m +++ b/OpenChange/MAPIStoreSOGo.m @@ -74,8 +74,13 @@ sogo_backend_unexpected_error() static enum mapistore_error sogo_backend_handle_objc_exception(NSException *e, const char *fn_name, const int line_no) { - NSLog(@"[SOGo: %s:%d] - EXCEPTION: %@, reason: %@, backtrace: %@", - fn_name, line_no, [e name], [e reason], [e callStackSymbols]); + NSString *callStackSymbols = nil; + if ([e respondsToSelector:@selector(callStackSymbols)]) + { + callStackSymbols = [[e callStackSymbols] componentsJoinedByString:@"\n\t"]; + } + NSLog(@"[SOGo: %s:%d] - EXCEPTION: %@, reason: %@, backtrace: \n\t%@\n", + fn_name, line_no, [e name], [e reason], callStackSymbols); // Another point of view on the stack trace {