forked from recurly/recurly-client-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi_errors.rb
90 lines (57 loc) · 2.59 KB
/
api_errors.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# This file is automatically created by Recurly's OpenAPI generation process
# and thus any edits you make by hand will be lost. If you wish to make a
# change to this file, please create a Github issue explaining the changes you
# need and we will usher them to the appropriate places.
module Recurly
module Errors
ERROR_MAP = {
"500" => "InternalServerError",
"502" => "BadGatewayError",
"503" => "ServiceUnavailableError",
"504" => "TimeoutError",
"304" => "NotModifiedError",
"400" => "BadRequestError",
"401" => "UnauthorizedError",
"402" => "PaymentRequiredError",
"403" => "ForbiddenError",
"404" => "NotFoundError",
"406" => "NotAcceptableError",
"412" => "PreconditionFailedError",
"422" => "UnprocessableEntityError",
"429" => "TooManyRequestsError",
}
class ResponseError < Errors::APIError; end
class ServerError < ResponseError; end
class InternalServerError < ServerError; end
class ServiceNotAvailableError < InternalServerError; end
class TaxServiceError < InternalServerError; end
class BadGatewayError < ServerError; end
class ServiceUnavailableError < ServerError; end
class TimeoutError < ServerError; end
class RedirectionError < ResponseError; end
class NotModifiedError < ResponseError; end
class ClientError < Errors::APIError; end
class BadRequestError < ClientError; end
class InvalidContentTypeError < BadRequestError; end
class UnauthorizedError < ClientError; end
class PaymentRequiredError < ClientError; end
class ForbiddenError < ClientError; end
class InvalidApiKeyError < ForbiddenError; end
class InvalidPermissionsError < ForbiddenError; end
class NotFoundError < ClientError; end
class NotAcceptableError < ClientError; end
class UnknownApiVersionError < NotAcceptableError; end
class UnavailableInApiVersionError < NotAcceptableError; end
class InvalidApiVersionError < NotAcceptableError; end
class PreconditionFailedError < ClientError; end
class UnprocessableEntityError < ClientError; end
class ValidationError < UnprocessableEntityError; end
class MissingFeatureError < UnprocessableEntityError; end
class TransactionError < UnprocessableEntityError; end
class SimultaneousRequestError < UnprocessableEntityError; end
class ImmutableSubscriptionError < UnprocessableEntityError; end
class InvalidTokenError < UnprocessableEntityError; end
class TooManyRequestsError < ClientError; end
class RateLimitedError < TooManyRequestsError; end
end
end