startback 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/startback/context/middleware.rb +4 -0
- data/lib/startback/errors.rb +90 -1
- data/lib/startback/version.rb +1 -1
- data/lib/startback/web/api.rb +1 -1
- data/lib/startback/web/catch_all.rb +1 -1
- data/lib/startback/web/shield.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9175aaa7fe416e9e0fa330799a3f000fed9eb44
|
4
|
+
data.tar.gz: 9afc103aefdbcb65ee348e121d0801de5e303adf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3731debf460f9d572bd30970e0cfed5a399d753719b986ffd485548d3cdcff9f239bf917ac8bc1d4902a34db2ad42e23ccb8d32f9a88b46c3ebab9dbd576e61f
|
7
|
+
data.tar.gz: 6f772f553bcfc9a257f24e0d5b413eb6e131b690aa438e17b22f56d198efb98e8317366540b7822e04bf6d435ba7243ce6c809ba06c7040a75c16b22fe4fb478
|
data/lib/startback/errors.rb
CHANGED
@@ -90,6 +90,95 @@ module Startback
|
|
90
90
|
status 501
|
91
91
|
end
|
92
92
|
|
93
|
+
### Helper methods
|
94
|
+
|
95
|
+
def bad_request_error!(msg = nil)
|
96
|
+
raise Startback::Errors::BadRequestError, msg
|
97
|
+
end
|
98
|
+
module_function :bad_request_error!
|
99
|
+
|
100
|
+
def unauthorized_error!(msg = nil)
|
101
|
+
raise Startback::Errors::UnauthorizedError, msg
|
102
|
+
end
|
103
|
+
module_function :unauthorized_error!
|
104
|
+
|
105
|
+
def forbidden_error!(msg = nil)
|
106
|
+
raise Startback::Errors::ForbiddenError, msg
|
107
|
+
end
|
108
|
+
module_function :forbidden_error!
|
109
|
+
|
110
|
+
def not_found_error!(msg = nil)
|
111
|
+
raise Startback::Errors::NotFoundError, "#{msg} not found"
|
112
|
+
end
|
113
|
+
module_function :not_found_error!
|
114
|
+
|
115
|
+
def method_not_allowed_error!(msg = nil)
|
116
|
+
raise Startback::Errors::MethodNotAllowedError, msg
|
117
|
+
end
|
118
|
+
module_function :method_not_allowed_error!
|
119
|
+
|
120
|
+
def not_acceptable_error!(msg = nil)
|
121
|
+
raise Startback::Errors::NotAcceptableError, msg
|
122
|
+
end
|
123
|
+
module_function :not_acceptable_error!
|
124
|
+
|
125
|
+
def conflict_error!(msg = nil)
|
126
|
+
raise Startback::Errors::ConflictError, msg
|
127
|
+
end
|
128
|
+
module_function :conflict_error!
|
129
|
+
|
130
|
+
def gone_error!(msg = nil)
|
131
|
+
raise Startback::Errors::GoneError, msg
|
132
|
+
end
|
133
|
+
module_function :gone_error!
|
134
|
+
|
135
|
+
def precondition_failed_error!(msg = nil)
|
136
|
+
raise Startback::Errors::PreconditionFailedError, msg
|
137
|
+
end
|
138
|
+
module_function :precondition_failed_error!
|
139
|
+
|
140
|
+
def unsupported_media_type_error!(media)
|
141
|
+
raise Startback::Errors::UnsupportedMediaTypeError, "Unable to use `#{media}` as input data"
|
142
|
+
end
|
143
|
+
module_function :unsupported_media_type_error!
|
144
|
+
|
145
|
+
def expectation_failed_error!(msg = nil)
|
146
|
+
raise Startback::Errors::ExpectationFailedError, msg
|
147
|
+
end
|
148
|
+
module_function :expectation_failed_error!
|
149
|
+
|
150
|
+
def locked_error!(msg = nil)
|
151
|
+
raise Startback::Errors::LockedError, msg
|
152
|
+
end
|
153
|
+
module_function :locked_error!
|
154
|
+
|
155
|
+
def precondition_required_error!(msg = nil)
|
156
|
+
raise Startback::Errors::PreconditionRequiredError, msg
|
157
|
+
end
|
158
|
+
module_function :precondition_required_error!
|
159
|
+
|
160
|
+
def internal_server_error!(msg = nil)
|
161
|
+
raise Startback::Errors::InternalServerError, msg
|
162
|
+
end
|
163
|
+
module_function :internal_server_error!
|
164
|
+
|
165
|
+
def not_implemented_error!(msg = nil)
|
166
|
+
raise Startback::Errors::NotImplementedError, msg
|
167
|
+
end
|
168
|
+
module_function :not_implemented_error!
|
169
|
+
|
170
|
+
# Aliases
|
171
|
+
|
172
|
+
def user_error!(msg = nil)
|
173
|
+
raise Startback::Errors::BadRequestError, msg
|
174
|
+
end
|
175
|
+
module_function :user_error!
|
176
|
+
|
177
|
+
def server_error!(msg = nil)
|
178
|
+
raise Startback::Errors::InternalServerError, msg
|
179
|
+
end
|
180
|
+
module_function :server_error!
|
181
|
+
|
93
182
|
end # module Errors
|
94
183
|
include Errors
|
95
|
-
end # module
|
184
|
+
end # module Startback
|
data/lib/startback/version.rb
CHANGED
data/lib/startback/web/api.rb
CHANGED
data/lib/startback/web/shield.rb
CHANGED
@@ -23,7 +23,8 @@ module Startback
|
|
23
23
|
self.content_type 'application/json'
|
24
24
|
|
25
25
|
# Decoding errors from json and csv are considered user's fault
|
26
|
-
self.on(Finitio::TypeError)
|
26
|
+
self.on(Finitio::TypeError){ 400 }
|
27
|
+
self.on(::NotImplementedError){ 501 }
|
27
28
|
|
28
29
|
# Various other codes for the framework specific error classes
|
29
30
|
self.on(Startback::Errors::Error) {|ex|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: startback
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bernard Lambeau
|
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
201
|
version: '0'
|
202
202
|
requirements: []
|
203
203
|
rubyforge_project:
|
204
|
-
rubygems_version: 2.
|
204
|
+
rubygems_version: 2.6.11
|
205
205
|
signing_key:
|
206
206
|
specification_version: 4
|
207
207
|
summary: Got Your Ruby Back
|