Closed walro closed 5 years ago
Or possibly PaymentRequiredError
as 402 might expand to more things in the future.
How about AccessDenied?
I.e. we're authorized but don't have access to to this part of the API (language in this case). Or separate to AuthorizationError
(lang error) and AuthenticationError
(api key error)?
Or separate to
AuthorizationError
(lang error) andAuthenticationError
(api key error)?
This sounds good to me
Ok, I'm thinking it's easiest if we just remove AuthError
when doing this, ie. no deprecation period. I think it's too hard to deprecate it in a reasonable way, i.e. if we'd be able to handle it with the existing error class we wouldn't change it in the first place.
Currently we do not differentiate between 401 and 402 errors: https://github.com/twingly/twingly-search-api-ruby/blob/785d8604c2422eee7a1abc26422649fcdc57f861/lib/twingly/search/error.rb#L9-L10
Raising
AuthError
for 401 class of errors is fine, but for 402 we should probably raise something likeLanguageSelectionError
, see: https://developer.twingly.com/resources/search/#4xx-client-errors