squall 1.2.1beta1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,23 +0,0 @@
1
- module Squall
2
- class OnAppErrors < Faraday::Response::Middleware
3
-
4
- def on_complete(env)
5
- # https://help.onapp.com/manual.php?m=2#p29
6
- case env[:status]
7
- when 403
8
- raise Squall::ForbiddenError, response_values(env)
9
- when 404
10
- raise Squall::NotFoundError, response_values(env)
11
- when 422
12
- raise Squall::ClientError, response_values(env)
13
- when 500
14
- raise Squall::ServerError, response_values(env)
15
- end
16
- end
17
-
18
- def response_values(env)
19
- {:status => env[:status], :headers => env[:response_headers], :body => env[:body]}
20
- end
21
-
22
- end
23
- end