lib/workos/errors.rb in workos-4.8.0 vs lib/workos/errors.rb in workos-5.0.0

- old
+ new

@@ -5,28 +5,36 @@ class WorkOSError < StandardError attr_reader :http_status attr_reader :request_id attr_reader :code attr_reader :errors + attr_reader :error + attr_reader :error_description + attr_reader :data + attr_reader :retry_after # rubocop:disable Metrics/ParameterLists def initialize( message: nil, error: nil, error_description: nil, http_status: nil, request_id: nil, code: nil, - errors: nil + errors: nil, + data: nil, + retry_after: nil ) @message = message @error = error @error_description = error_description @http_status = http_status @request_id = request_id @code = code @errors = errors + @data = data + @retry_after = retry_after end # rubocop:enable Metrics/ParameterLists def to_s status_string = @http_status.nil? ? '' : "Status #{@http_status}, " @@ -60,6 +68,15 @@ # webhook fails class SignatureVerificationError < WorkOSError; end # TimeoutError is raised when the HTTP request to the API times out class TimeoutError < WorkOSError; end + + # RateLimitExceededError is raised when the rate limit for the API has been hit + class RateLimitExceededError < WorkOSError; end + + # NotFoundError is raised when a resource is not found + class NotFoundError < WorkOSError; end + + # UnprocessableEntityError is raised when a request is made that cannot be processed + class UnprocessableEntityError < WorkOSError; end end