From 90258c5001c862cfd03f829d4aab2feac240eef6 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 15 Feb 2019 10:44:08 +0200 Subject: pretty up logging of exceptions Add exceptionToString() and getCaughtExceptionAsString() methods in tools. Use the new methods in DbgUnhandledException() Add special-case case code for most of the exceptions that contain extra fields, so all of the relevant data ends up in the log Change-Id: I376f6549b4d7bd480202f8bff17a454657c75ece Reviewed-on: https://gerrit.libreoffice.org/67857 Tested-by: Jenkins Reviewed-by: Noel Grandin --- slideshow/source/engine/activitiesqueue.cxx | 5 ++--- slideshow/source/engine/animationnodes/animationbasenode.cxx | 2 +- slideshow/source/engine/eventqueue.cxx | 2 +- slideshow/source/engine/pointersymbol.cxx | 3 ++- slideshow/source/engine/shapes/drawinglayeranimation.cxx | 2 +- slideshow/source/engine/shapes/externalshapebase.cxx | 2 +- slideshow/source/engine/shapes/viewbackgroundshape.cxx | 2 +- slideshow/source/engine/shapes/viewmediashape.cxx | 4 ++-- slideshow/source/engine/slide/layermanager.cxx | 2 +- slideshow/source/engine/slide/slideanimations.cxx | 2 +- slideshow/source/engine/slide/slideimpl.cxx | 6 +++--- slideshow/source/engine/slidebitmap.cxx | 2 +- slideshow/source/engine/slideshowimpl.cxx | 2 +- slideshow/source/engine/soundplayer.cxx | 2 +- slideshow/source/engine/waitsymbol.cxx | 3 ++- slideshow/test/demoshow.cxx | 2 +- 16 files changed, 22 insertions(+), 21 deletions(-) (limited to 'slideshow') diff --git a/slideshow/source/engine/activitiesqueue.cxx b/slideshow/source/engine/activitiesqueue.cxx index 8eadd83428e8..a508ecb0067a 100644 --- a/slideshow/source/engine/activitiesqueue.cxx +++ b/slideshow/source/engine/activitiesqueue.cxx @@ -18,8 +18,7 @@ */ -#include -#include +#include #include #include @@ -123,7 +122,7 @@ namespace slideshow // since this will also capture segmentation // violations and the like. In such a case, we // still better let our clients now... - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString(cppu::getCaughtException()) ); } catch( SlideShowException& ) { diff --git a/slideshow/source/engine/animationnodes/animationbasenode.cxx b/slideshow/source/engine/animationnodes/animationbasenode.cxx index 0b7dae6bc70b..cfcd3be54853 100644 --- a/slideshow/source/engine/animationnodes/animationbasenode.cxx +++ b/slideshow/source/engine/animationnodes/animationbasenode.cxx @@ -209,7 +209,7 @@ bool AnimationBaseNode::init_st() mpActivity = createActivity(); } catch (uno::Exception const&) { - SAL_WARN( "slideshow", comphelper::anyToString(cppu::getCaughtException()) ); + SAL_WARN( "slideshow", exceptionToString(cppu::getCaughtException()) ); // catch and ignore. We later handle empty activities, but for // other nodes to function properly, the core functionality of // this node must remain up and running. diff --git a/slideshow/source/engine/eventqueue.cxx b/slideshow/source/engine/eventqueue.cxx index e1c53c4da4f6..4277677dcda8 100644 --- a/slideshow/source/engine/eventqueue.cxx +++ b/slideshow/source/engine/eventqueue.cxx @@ -238,7 +238,7 @@ namespace slideshow // since this will also capture segmentation // violations and the like. In such a case, we // still better let our clients now... - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); } catch( SlideShowException& ) { diff --git a/slideshow/source/engine/pointersymbol.cxx b/slideshow/source/engine/pointersymbol.cxx index 52c453e3eea6..daa62e61942e 100644 --- a/slideshow/source/engine/pointersymbol.cxx +++ b/slideshow/source/engine/pointersymbol.cxx @@ -29,6 +29,7 @@ #include #include +#include #include "pointersymbol.hxx" #include @@ -126,7 +127,7 @@ void PointerSymbol::viewAdded( const UnoViewSharedPtr& rView ) } catch( uno::Exception& ) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); } maViews.emplace_back( rView, sprite ); diff --git a/slideshow/source/engine/shapes/drawinglayeranimation.cxx b/slideshow/source/engine/shapes/drawinglayeranimation.cxx index c2aa3a695765..f46f82269f66 100644 --- a/slideshow/source/engine/shapes/drawinglayeranimation.cxx +++ b/slideshow/source/engine/shapes/drawinglayeranimation.cxx @@ -935,7 +935,7 @@ std::shared_ptr createDrawingLayerAnimActivity( catch( uno::Exception& ) { // translate any error into empty factory product. - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); } return pActivity; diff --git a/slideshow/source/engine/shapes/externalshapebase.cxx b/slideshow/source/engine/shapes/externalshapebase.cxx index fc7b00ead6d1..00ba2bb2c37b 100644 --- a/slideshow/source/engine/shapes/externalshapebase.cxx +++ b/slideshow/source/engine/shapes/externalshapebase.cxx @@ -108,7 +108,7 @@ namespace slideshow } catch (uno::Exception &) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); } } diff --git a/slideshow/source/engine/shapes/viewbackgroundshape.cxx b/slideshow/source/engine/shapes/viewbackgroundshape.cxx index 029c2a52fbc2..27c2bfe43d6d 100644 --- a/slideshow/source/engine/shapes/viewbackgroundshape.cxx +++ b/slideshow/source/engine/shapes/viewbackgroundshape.cxx @@ -185,7 +185,7 @@ namespace slideshow } catch( uno::Exception& ) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); return false; } diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx index 84d7e363d339..70a37e8c6394 100644 --- a/slideshow/source/engine/shapes/viewmediashape.cxx +++ b/slideshow/source/engine/shapes/viewmediashape.cxx @@ -321,7 +321,7 @@ namespace slideshow } catch( uno::Exception& ) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); } } } @@ -482,7 +482,7 @@ namespace slideshow } catch( uno::Exception& ) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); } } } diff --git a/slideshow/source/engine/slide/layermanager.cxx b/slideshow/source/engine/slide/layermanager.cxx index 333412d90029..c13120ef1958 100644 --- a/slideshow/source/engine/slide/layermanager.cxx +++ b/slideshow/source/engine/slide/layermanager.cxx @@ -622,7 +622,7 @@ namespace slideshow { // TODO(E1): Might be superfluous. Nowadays, // addViewLayer swallows all errors, anyway. - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); // at least one shape could not be rendered bRet = false; } diff --git a/slideshow/source/engine/slide/slideanimations.cxx b/slideshow/source/engine/slide/slideanimations.cxx index 8c6be3eeb99f..4a08319eca36 100644 --- a/slideshow/source/engine/slide/slideanimations.cxx +++ b/slideshow/source/engine/slide/slideanimations.cxx @@ -55,7 +55,7 @@ namespace slideshow } catch (uno::Exception &) { - SAL_WARN( "slideshow", comphelper::anyToString(cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString(cppu::getCaughtException() ) ); } } } diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index ee119ce4549d..8f721d0d07f6 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -773,7 +773,7 @@ bool SlideImpl::implPrefetchShow() } catch( uno::Exception& ) { - SAL_WARN( "slideshow", comphelper::anyToString(cppu::getCaughtException()) ); + SAL_WARN( "slideshow", exceptionToString(cppu::getCaughtException()) ); // TODO(E2): Error handling. For now, bail out } @@ -1031,7 +1031,7 @@ bool SlideImpl::loadShapes() } catch( uno::Exception& ) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); return false; } } @@ -1070,7 +1070,7 @@ bool SlideImpl::loadShapes() } catch( uno::Exception& ) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); return false; } diff --git a/slideshow/source/engine/slidebitmap.cxx b/slideshow/source/engine/slidebitmap.cxx index 4cf61b727678..4a92633924d6 100644 --- a/slideshow/source/engine/slidebitmap.cxx +++ b/slideshow/source/engine/slidebitmap.cxx @@ -85,7 +85,7 @@ namespace slideshow } catch( uno::Exception& ) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); return false; } diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index 9b7eadb65cd6..41bd954fc197 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -2083,7 +2083,7 @@ sal_Bool SlideShowImpl::update( double & nNextTimeout ) } catch( uno::Exception& ) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); } } diff --git a/slideshow/source/engine/soundplayer.cxx b/slideshow/source/engine/soundplayer.cxx index 2f19fca124b9..ddee95a3eaea 100644 --- a/slideshow/source/engine/soundplayer.cxx +++ b/slideshow/source/engine/soundplayer.cxx @@ -121,7 +121,7 @@ namespace slideshow dispose(); } catch (uno::Exception &) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); } } diff --git a/slideshow/source/engine/waitsymbol.cxx b/slideshow/source/engine/waitsymbol.cxx index b232f42aa5b5..34cff4a15c8f 100644 --- a/slideshow/source/engine/waitsymbol.cxx +++ b/slideshow/source/engine/waitsymbol.cxx @@ -29,6 +29,7 @@ #include #include +#include #include "waitsymbol.hxx" #include @@ -130,7 +131,7 @@ void WaitSymbol::viewAdded( const UnoViewSharedPtr& rView ) } catch( uno::Exception& ) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); } maViews.emplace_back( rView, sprite ); diff --git a/slideshow/test/demoshow.cxx b/slideshow/test/demoshow.cxx index fe3d29363942..431a9bc77c66 100644 --- a/slideshow/test/demoshow.cxx +++ b/slideshow/test/demoshow.cxx @@ -520,7 +520,7 @@ void DemoApp::Main() } catch( uno::Exception& ) { - SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); + SAL_WARN( "slideshow", exceptionToString( cppu::getCaughtException() ) ); } if( !xFactory.is() ) -- cgit