Exception: Ollama::HTTPError
- Defined in:
- lib/ollama/errors.rb
Overview
HTTP error with retry logic
Direct Known Subclasses
ModelUnavailableError, NotFoundError, RateLimitError, UnauthorizedError
Instance Attribute Summary collapse
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
-
#initialize(message, status_code = nil) ⇒ HTTPError
constructor
A new instance of HTTPError.
- #retryable? ⇒ Boolean
Constructor Details
#initialize(message, status_code = nil) ⇒ HTTPError
Returns a new instance of HTTPError.
61 62 63 64 |
# File 'lib/ollama/errors.rb', line 61 def initialize(, status_code = nil) super() @status_code = status_code end |
Instance Attribute Details
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
59 60 61 |
# File 'lib/ollama/errors.rb', line 59 def status_code @status_code end |
Instance Method Details
#retryable? ⇒ Boolean
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/ollama/errors.rb', line 66 def retryable? # Explicit retry policy: # - Retry: 408 (Request Timeout), 429 (Too Many Requests), # 500 (Internal Server Error), 502 (Bad Gateway), 503 (Service Unavailable) # - Never retry: 400-407, 409-428, 430-499 (client errors) # - Never retry: 501, 504-599 (other server errors - may indicate permanent issues) return true if @status_code.nil? # Unknown status - retry for safety return true if [408, 429, 500, 502, 503].include?(@status_code) false end |