Exception: GMO::PG::Error
- Inherits:
-
StandardError
- Object
- StandardError
- GMO::PG::Error
show all
- Defined in:
- lib/gmo-pg/error.rb
Class Method Summary
collapse
Class Method Details
.from_api_error(err_code, err_info) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/gmo-pg/error.rb', line 20
def self.from_api_error(err_code, err_info)
case err_info
when /\AE01(01|02|03|19|20|21)/
GMO::PG::AuthorizationError.new('Authorization error', err_code, err_info)
when /\AE01(17|18|25|26|27|46|48)/, /\A(E41|42G)/, /\AE61010002\Z/
GMO::PG::CardError.new('Card error', err_code, err_info)
when /\A(E61|E91|E92|42C)/
GMO::PG::APIServerError.new('Temporary unavailable', err_code, err_info)
else
GMO::PG::APIError.new('API error', err_code, err_info)
end
end
|
.from_http_error(e) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/gmo-pg/error.rb', line 4
def self.from_http_error(e)
case e
when Timeout::Error
GMO::PG::ConnectionError.new(e.message)
when Net::HTTPError,
Net::HTTPRetriableError,
Net::HTTPServerException,
Net::HTTPFatalError,
Net::HTTPBadResponse,
Net::HTTPHeaderSyntaxError
GMO::PG::HTTPError.new(e.message)
else
new(e.message)
end
end
|