imap-backup 14.1.0 → 14.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/imap/backup/serializer/appender.rb +27 -6
- data/lib/imap/backup/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93047de8b1a28cd27279cae2d5950c1b9856c767b9ac064b57912f5d83812c74
|
4
|
+
data.tar.gz: 5425573d8f53cffc4624b4467265acd390596ec43ba5314bb7312ed13f41b585
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50abe7600f61974ad45054e6b58b9d2cfcd72c9e25665ede1165637602e0df821506fe0d9b936f1d8f542f8cbd98b6587253496cd941d2ac0430b32cc2558d33
|
7
|
+
data.tar.gz: cad3792a03accae1f180936b49047822400a8b7644978ff42d1d38c5c7d585f70ea05095849742e3a2bb2289310c64a46605203ec4ff7d87175d2f1db2235f9d
|
@@ -28,21 +28,42 @@ module Imap::Backup
|
|
28
28
|
return
|
29
29
|
end
|
30
30
|
|
31
|
-
|
31
|
+
begin
|
32
32
|
serialized = to_serialized(message)
|
33
|
+
rescue StandardError => e
|
34
|
+
raise wrap_error(
|
35
|
+
error: e,
|
36
|
+
note: "failed to serialize message",
|
37
|
+
folder: folder,
|
38
|
+
uid: uid,
|
39
|
+
message: message
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
43
|
+
rollback_on_error do
|
33
44
|
mbox.append serialized
|
34
45
|
imap.append uid, serialized.bytesize, flags: flags
|
35
46
|
rescue StandardError => e
|
36
|
-
raise
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
47
|
+
raise wrap_error(
|
48
|
+
error: e,
|
49
|
+
note: "failed to append message",
|
50
|
+
folder: folder,
|
51
|
+
uid: uid,
|
52
|
+
message: message
|
53
|
+
)
|
41
54
|
end
|
42
55
|
end
|
43
56
|
|
44
57
|
private
|
45
58
|
|
59
|
+
def wrap_error(error:, note:, folder:, uid:, message:)
|
60
|
+
<<-ERROR.gsub(/^\s*/m, "")
|
61
|
+
[#{folder}] #{note} #{uid}: #{message}.
|
62
|
+
#{error}:
|
63
|
+
#{error.backtrace.join("\n")}"
|
64
|
+
ERROR
|
65
|
+
end
|
66
|
+
|
46
67
|
def to_serialized(message)
|
47
68
|
mboxrd_message = Email::Mboxrd::Message.new(message)
|
48
69
|
mboxrd_message.to_serialized
|
data/lib/imap/backup/version.rb
CHANGED