coaster 1.0.4 → 1.0.5
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/coaster/core_ext/standard_error.rb +16 -50
- data/lib/coaster/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: 71910814edd2fcc1011e2f7bbc0d5003d3ffacca49d8a60f4869859d7c911afd
|
4
|
+
data.tar.gz: 5898b403bcb2263ff96c70721f724b5f91d9e52dff474f90a9ea854effba5676
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd1a8ee8e2f472633ef7ea34588cde48d77cb053ad186aac02702c806afbb4dd8829ece4892e456413ca6c840afa77d637f9fa2e068922319b4a4bd850ded75e
|
7
|
+
data.tar.gz: 8996da8e600df0d704353b89daba9f2c97b4261e4b77c7be32aa32644cb8c8018ef8b4f323de6186f5e6deeabe44f304ca0979a4c1b96abf714300487e0d11db
|
@@ -4,14 +4,11 @@ class StandardError
|
|
4
4
|
cattr_accessor :cleaner, :cause_cleaner
|
5
5
|
|
6
6
|
class << self
|
7
|
-
def status
|
8
|
-
999999 # Unknown
|
9
|
-
end
|
7
|
+
def status; 999999 end # Unknown
|
10
8
|
alias_method :code, :status
|
11
|
-
|
12
|
-
def
|
13
|
-
|
14
|
-
end
|
9
|
+
def http_status; 500 end
|
10
|
+
def report?; true end
|
11
|
+
def intentional?; false end
|
15
12
|
|
16
13
|
def title
|
17
14
|
t = _translate('.title')
|
@@ -66,17 +63,9 @@ class StandardError
|
|
66
63
|
super(msg)
|
67
64
|
end
|
68
65
|
|
69
|
-
def safe_message
|
70
|
-
|
71
|
-
end
|
72
|
-
|
73
|
-
def status
|
74
|
-
self.class.status
|
75
|
-
end
|
76
|
-
|
77
|
-
def title
|
78
|
-
attributes[:title] || self.class.title
|
79
|
-
end
|
66
|
+
def safe_message; message || '' end
|
67
|
+
def status; self.class.status end
|
68
|
+
def root_cause; cause.respond_to?(:root_cause) ? cause.root_cause : self end
|
80
69
|
|
81
70
|
def attributes
|
82
71
|
return @attributes if defined?(@attributes)
|
@@ -88,29 +77,15 @@ class StandardError
|
|
88
77
|
end
|
89
78
|
alias_method :attr, :attributes
|
90
79
|
|
91
|
-
def http_status
|
92
|
-
|
93
|
-
end
|
94
|
-
|
95
|
-
def
|
96
|
-
|
97
|
-
end
|
98
|
-
|
99
|
-
|
100
|
-
attributes.key?(:report) ? attributes[:report] : true
|
101
|
-
end
|
102
|
-
|
103
|
-
def intentional?
|
104
|
-
attributes[:intentional]
|
105
|
-
end
|
106
|
-
|
107
|
-
def code
|
108
|
-
attributes[:code] || status
|
109
|
-
end
|
110
|
-
|
111
|
-
def code=(value)
|
112
|
-
attributes[:code] = value
|
113
|
-
end
|
80
|
+
def http_status; attributes[:http_status] || self.class.http_status end
|
81
|
+
def http_status=(value); attributes[:http_status] = value end
|
82
|
+
def code; attributes[:code] || status end
|
83
|
+
def code=(value); attributes[:code] = value end
|
84
|
+
def title; attributes[:title] || self.class.title end
|
85
|
+
def report?; attributes.key?(:report) ? attributes[:report] : self.class.report? end
|
86
|
+
def intentional?; attributes.key?(:intentional) ? attributes[:intentional] : self.class.intentional? end
|
87
|
+
def object; attributes[:object] || attributes[:obj] end
|
88
|
+
alias_method :obj, :object
|
114
89
|
|
115
90
|
# description is user friendly messages, do not use error's message
|
116
91
|
# error message is not user friendly in many cases.
|
@@ -130,15 +105,6 @@ class StandardError
|
|
130
105
|
attributes[:descriptions]
|
131
106
|
end
|
132
107
|
|
133
|
-
def object
|
134
|
-
attributes[:object] || attributes[:obj]
|
135
|
-
end
|
136
|
-
alias_method :obj, :object
|
137
|
-
|
138
|
-
def root_cause
|
139
|
-
cause.respond_to?(:root_cause) ? cause.root_cause : self
|
140
|
-
end
|
141
|
-
|
142
108
|
def to_hash
|
143
109
|
hash = attributes.merge(
|
144
110
|
type: self.class.name, status: status,
|
data/lib/coaster/version.rb
CHANGED