Skip to content

Commit 730c164

Browse files
borysiastym-kuhn
authored andcommitted
[Processing] Yet another fix for error message encoding errors (for 2.14) (#4042)
* [Processing] Yet another fix for error message encoding errors. Fixes #16102 * [Processing] Follow up 1ede526
1 parent 538b7c9 commit 730c164

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

python/plugins/processing/core/GeoAlgorithm.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,13 @@ def execute(self, progress=None, model=None):
213213
lines = [self.tr('Uncaught error while executing algorithm')]
214214
lines.append(traceback.format_exc())
215215
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR, lines)
216+
try:
217+
message = unicode(e)
218+
except UnicodeDecodeError:
219+
# Try with the 'replace' mode (requires e.message instead of e!)
220+
message = unicode(e.message, 'utf-8', 'replace')
216221
raise GeoAlgorithmExecutionException(
217-
unicode(e.message, errors='replace') + self.tr(u'\nSee log for more details'))
222+
message + self.tr(' \nSee log for more details'), lines, e)
218223

219224
def _checkParameterValuesBeforeExecuting(self):
220225
for param in self.parameters:

0 commit comments

Comments
 (0)