beekeeper 0.1.10 → 0.1.11

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: 611a1517926552620ecae26b7f8721bca3fd62ea16678034a1537c8509b3b02e
4
- data.tar.gz: a938f640af2a58c24a0cd64c4be443cb3870b67d24e97675d4fbd5deb818caec
3
+ metadata.gz: 035ab20ad054e4b16ca26bdc92194b00cf66a6feac49fda56853d8fac146c040
4
+ data.tar.gz: d33daa2eefbf2cdc1125694b3a6b2d459b041e6becbc070d66b9d6f686ee4661
5
5
  SHA512:
6
- metadata.gz: 9a6916e9476fa13f9a70a4fb74cb5858ae5712cfe55dbb21316051653967bcb94cc390a7003814f5887359aebdfee6430113cf8f8521dd60da2e1f20c8d82071
7
- data.tar.gz: df5ae7c4318580ab15a7f22d54384385d8eca218b057d411f029629d5b3b852dee882d9ed647c1a7f3096589b6937a00936d0cf1ed844bc4fc4d8273da3ba8f9
6
+ metadata.gz: dcd3fc0caaa472eefa8ea27787df31db48d3563d16efde80a34812fff903e687155af3ea39dc4e8ee3188e16055e0c867abb1e89e063cb691d64257560b2b4d6
7
+ data.tar.gz: a820189ee799fe8de516f45f727972404ddb82737ef70d4036c5cc017b9d864feed4211a489f3cf7ba23e099ccfa903d13175c5e9303ba5eb541122a2a12dba0
@@ -1,21 +1,21 @@
1
1
  module Beekeeper
2
2
  class Logger
3
- def self.fatal(error)
3
+ def self.fatal(error, logger: nil)
4
4
  message = if error.respond_to? :backtrace
5
5
  message_with_backtrace(error)
6
6
  else
7
7
  error
8
8
  end
9
- Rails.logger.fatal message
9
+ internal_logger(logger).fatal message
10
10
  end
11
11
 
12
- def self.error(error)
12
+ def self.error(error, logger: nil)
13
13
  message = if error.respond_to? :backtrace
14
14
  message_with_backtrace(error)
15
15
  else
16
16
  error
17
17
  end
18
- Rails.logger.error message
18
+ internal_logger(logger).error message
19
19
  end
20
20
 
21
21
  private
@@ -32,6 +32,10 @@ module Beekeeper
32
32
  bc.clean(backtrace).map! { |t| " #{t}\n" }
33
33
  end
34
34
 
35
+ def internal_logger(logger)
36
+ logger || Rails.logger
37
+ end
38
+
35
39
  end
36
40
  end
37
41
 
@@ -7,7 +7,10 @@ module Beekeeper
7
7
  RESCUABLE_ERRORS = [
8
8
  ::Beekeeper::Error,
9
9
  ::Apipie::Error,
10
- ::ActiveRecord::RecordInvalid
10
+ ::ActiveRecord::RecordInvalid,
11
+ ::ActiveRecord::RecordNotUnique,
12
+ ::ActiveRecord::RecordNotFound,
13
+ ::ActiveRecord::ActiveRecordError,
11
14
  ]
12
15
 
13
16
  rescue_from(*RESCUABLE_ERRORS, with: :handle_error)
@@ -1,3 +1,3 @@
1
1
  module Beekeeper
2
- VERSION = '0.1.10'
2
+ VERSION = '0.1.11'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beekeeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Omkar Joshi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-13 00:00:00.000000000 Z
11
+ date: 2020-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails