Skip to content

Commit 2a6feee

Browse files
committedApr 6, 2018
[processing] Always log python exceptions to logger
Because Python code cannot catch and rethrow c++ exceptions without losing context, we end up getting unknown exceptions caught by c++ from python code (phew!). So if we catch a python exception from processing, throw it into the log so at least there's the full debugging detail available on the console. (Not ideal. Would love to see a PR allowing the full error message to be passed correctly between c++/python/back again) (cherry-picked from f4445a0)
1 parent 08d85bb commit 2a6feee

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed
 

‎python/core/core.sip.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ ${DEFAULTDOCSTRINGSIGNATURE}
66
%ModuleCode
77

88
#include "qgsexception.h"
9+
#include "qgslogger.h"
910

1011
QString getTraceback()
1112
{
@@ -107,6 +108,7 @@ done:
107108

108109
%VirtualErrorHandler processing_exception_handler
109110
QString trace = getTraceback();
111+
QgsLogger::critical( trace );
110112
SIP_RELEASE_GIL( sipGILState );
111113
throw QgsProcessingException( trace );
112114
%End

0 commit comments

Comments
 (0)
Please sign in to comment.