Exception: Teamtailor::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Teamtailor::Error
- Defined in:
- lib/teamtailor/error.rb
Direct Known Subclasses
Class Method Summary collapse
Class Method Details
.from_response(body:, status:) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/teamtailor/error.rb', line 5 def self.from_response(body:, status:) case status when 401 Teamtailor::UnauthorizedRequestError.new when 406 json_response = JSON.parse(body) Teamtailor::InvalidApiVersionError.new( json_response.dig('errors', 'detail') ) end end |