Exception: Ollama::NotFoundError
- Defined in:
- lib/ollama/errors.rb
Overview
Specific error for 404 Not Found responses
Instance Attribute Summary collapse
-
#requested_model ⇒ Object
readonly
Returns the value of attribute requested_model.
-
#suggestions ⇒ Object
readonly
Returns the value of attribute suggestions.
Attributes inherited from HTTPError
Instance Method Summary collapse
-
#initialize(message = "Resource not found", requested_model: nil, suggestions: []) ⇒ NotFoundError
constructor
A new instance of NotFoundError.
- #retryable? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(message = "Resource not found", requested_model: nil, suggestions: []) ⇒ NotFoundError
Returns a new instance of NotFoundError.
41 42 43 44 45 |
# File 'lib/ollama/errors.rb', line 41 def initialize( = "Resource not found", requested_model: nil, suggestions: []) super("HTTP 404: #{}", 404) @requested_model = requested_model @suggestions = suggestions end |
Instance Attribute Details
#requested_model ⇒ Object (readonly)
Returns the value of attribute requested_model.
39 40 41 |
# File 'lib/ollama/errors.rb', line 39 def requested_model @requested_model end |
#suggestions ⇒ Object (readonly)
Returns the value of attribute suggestions.
39 40 41 |
# File 'lib/ollama/errors.rb', line 39 def suggestions @suggestions end |
Instance Method Details
#retryable? ⇒ Boolean
47 48 49 |
# File 'lib/ollama/errors.rb', line 47 def retryable? false end |
#to_s ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/ollama/errors.rb', line 51 def to_s msg = super return msg unless @requested_model && !@suggestions.empty? suggestion_text = @suggestions.map { |m| " - #{m}" }.join("\n") "#{msg}\n\nModel '#{@requested_model}' not found. Did you mean one of these?\n#{suggestion_text}" end |