lib/data-com-api/errors.rb in data-com-api-0.1.4 vs lib/data-com-api/errors.rb in data-com-api-0.1.5
- old
+ new
@@ -2,12 +2,13 @@
module DataComApi
class Error < StandardError
- API_HTTP_STATUS_CODE = 0
- API_ERROR_CODE = 'no error code provided'
+ API_HTTP_STATUS_CODE = 0
+ API_ERROR_CODE = 'no error code provided'.freeze
+ API_LIMIT_EXCEEDED_MSG = 'API plan limit exceeded'.freeze
attr_reader :http_status_code
attr_reader :api_stack_trace
attr_reader :error_code
@@ -89,8 +90,17 @@
end
class NotAvailableError < Error
API_HTTP_STATUS_CODE = 503
API_ERROR_CODE = 'NOT_AVAILABLE'.freeze
+ end
+
+ class ApiLimitExceededError < Error
+ # This info are not true, there is no error code nor status code, but
+ # I added those to keep consistency.
+ # The limit exceeded error is returned as "API plan limit exceeded" plain
+ # string
+ API_HTTP_STATUS_CODE = 404
+ API_ERROR_CODE = 'API_LIMIT_EXCEEDED'.freeze
end
end
\ No newline at end of file