Exception: Ollama::HTTPError
- Defined in:
- lib/ollama/errors.rb
Overview
HTTP error with retry logic
Direct Known Subclasses
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.
19 20 21 22 |
# File 'lib/ollama/errors.rb', line 19 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.
17 18 19 |
# File 'lib/ollama/errors.rb', line 17 def status_code @status_code end |
Instance Method Details
#retryable? ⇒ Boolean
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ollama/errors.rb', line 24 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 |