saoshyant 1.1 → 1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/saoshyant.rb +6 -1
- data/saoshyant.gemspec +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1e8f5039563d5adf7b102e4735e3af9f7ac53b003ec45116e49b8bfb2556a5b9
|
|
4
|
+
data.tar.gz: a7510586753167922756af504696d79e707b65e43baecba6b9be4120565b6b46
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8a557ab6a290bd574415a47f05791be506a465cc5f39df37005e26ff3d5c2c9a55fc1d50194b01de286b3bae12847fe22dfd7e9083356812528e8fdbdb1eae40
|
|
7
|
+
data.tar.gz: 0af188cc8d2ca50bc0462781c5b3d8188dc987021c8041baa22c9b360d1ebd5a36e05b634123124fbb13681f08e7f430a95cbfe77da4bb06d14a33f3bf6eca62
|
data/lib/saoshyant.rb
CHANGED
|
@@ -7,6 +7,7 @@ module Saoshyant
|
|
|
7
7
|
include ActiveSupport::Rescuable
|
|
8
8
|
|
|
9
9
|
@@exception_klasses = {}
|
|
10
|
+
@@block = nil
|
|
10
11
|
|
|
11
12
|
included do
|
|
12
13
|
rescue_from Exception, with: :execute_exception
|
|
@@ -19,11 +20,15 @@ module Saoshyant
|
|
|
19
20
|
@@exception_klasses.merge!(exception_klass => {code: code, log: log})
|
|
20
21
|
end
|
|
21
22
|
|
|
23
|
+
def saoshyant(&block)
|
|
24
|
+
@@block = block
|
|
25
|
+
end
|
|
26
|
+
|
|
22
27
|
def execute_exception ex
|
|
23
28
|
code = Saoshyant::ExceptionHandler.code_status ex, @@exception_klasses
|
|
24
29
|
log = Saoshyant::ExceptionHandler.log_status ex, @@exception_klasses
|
|
25
30
|
|
|
26
31
|
Saoshyant::ExceptionLogger.log(ex.message) if log == true
|
|
27
|
-
|
|
32
|
+
@@block.call(code, ex.message, ex.class.inspect)
|
|
28
33
|
end
|
|
29
34
|
end
|
data/saoshyant.gemspec
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = 'saoshyant'
|
|
3
|
-
s.version = '1.
|
|
3
|
+
s.version = '1.2'
|
|
4
4
|
s.date = '2020-02-10'
|
|
5
|
-
s.summary = "Handle Rails Exception
|
|
5
|
+
s.summary = "Handle Rails Exception"
|
|
6
6
|
s.description = "when exceptoin raised we dont want see it in ugly and red display, saoshyant present it in json response"
|
|
7
7
|
s.authors = ["Majid Imanzade"]
|
|
8
8
|
s.email = 'majidimanzade1@gmail.com'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: saoshyant
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: '1.
|
|
4
|
+
version: '1.2'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Majid Imanzade
|
|
@@ -91,5 +91,5 @@ requirements: []
|
|
|
91
91
|
rubygems_version: 3.1.2
|
|
92
92
|
signing_key:
|
|
93
93
|
specification_version: 4
|
|
94
|
-
summary: Handle Rails Exception
|
|
94
|
+
summary: Handle Rails Exception
|
|
95
95
|
test_files: []
|