You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2016/11/22 14:25:50 UTC

incubator-ponymail git commit: Add temporary hack to show message details for encoding error

Repository: incubator-ponymail
Updated Branches:
  refs/heads/master 8fa871600 -> 732fbedef


Add temporary hack to show message details for encoding error

Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/732fbede
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/732fbede
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/732fbede

Branch: refs/heads/master
Commit: 732fbedef15695e8e4aa86443254771d9104a5d2
Parents: 8fa8716
Author: Sebb <se...@apache.org>
Authored: Tue Nov 22 14:25:33 2016 +0000
Committer: Sebb <se...@apache.org>
Committed: Tue Nov 22 14:25:33 2016 +0000

----------------------------------------------------------------------
 tools/import-mbox.py | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/732fbede/tools/import-mbox.py
----------------------------------------------------------------------
diff --git a/tools/import-mbox.py b/tools/import-mbox.py
index 37e2d4f..e29bc4c 100755
--- a/tools/import-mbox.py
+++ b/tools/import-mbox.py
@@ -289,11 +289,16 @@ class SlurpThread(Thread):
                         except:
                             duplicates[json['mid']]=[json['message-id'] + " in " + filename]
 
-                    json_source = {
-                        'mid': json['mid'],
-                        'message-id': json['message-id'],
-                        'source': message.as_string()
-                    }
+                    try: # temporary hack to try and find an encoding issue
+                        # needs to be replaced by proper exception handling
+                        json_source = {
+                            'mid': json['mid'],
+                            'message-id': json['message-id'],
+                            'source': message.as_string()
+                        }
+                    except Exception as e:
+                        print("Error '%s' processing id %s msg %s " % (e, json['mid'], json['message-id']))
+                        continue
 
                     count += 1
                     ja.append(json)