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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0cf96ff7b006e9e09f0ec63c75f594879a43be7065a90a35909f128077ff1a06
4
- data.tar.gz: deb1c54af3238a9f8fea9f8cdb084acfde187590dc621f5280a2798dd48426cc
3
+ metadata.gz: 93047de8b1a28cd27279cae2d5950c1b9856c767b9ac064b57912f5d83812c74
4
+ data.tar.gz: 5425573d8f53cffc4624b4467265acd390596ec43ba5314bb7312ed13f41b585
5
5
  SHA512:
6
- metadata.gz: f170fcdfbad3ebe441d3860eec5123cd2e165749e9fb64824e9e5db1948ba2ff01fb4d8d52da6ce3ad1d607d2235b0bc58f670b95b78a57595b34b039471a689
7
- data.tar.gz: ad9180ddaf1ed6698627fc42bfb415cbf12abf5e6a9459483ec2c69c5bc6ef14c8465c95c5fd98934bb1d5bdbaf8c0a9c52bec27e0d6a7c34ff2fae7158b4aa7
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
- rollback_on_error do
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 <<-ERROR.gsub(/^\s*/m, "")
37
- [#{folder}] failed to append message #{uid}: #{message}.
38
- #{e}:
39
- #{e.backtrace.join("\n")}"
40
- ERROR
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
@@ -3,7 +3,7 @@ module Imap; end
3
3
  module Imap::Backup
4
4
  MAJOR = 14
5
5
  MINOR = 1
6
- REVISION = 0
6
+ REVISION = 1
7
7
  PRE = nil
8
8
  VERSION = [MAJOR, MINOR, REVISION, PRE].compact.map(&:to_s).join(".")
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imap-backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 14.1.0
4
+ version: 14.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Yates