Exception: Fizzy::AmbiguousError
- Defined in:
- lib/fizzy/errors.rb
Overview
Raised when a name/identifier matches multiple resources.
Instance Attribute Summary collapse
-
#matches ⇒ Array<String>
readonly
List of matching resources.
Attributes inherited from Error
#cause, #code, #hint, #http_status, #request_id, #retry_after, #retryable
Instance Method Summary collapse
-
#initialize(resource, matches: []) ⇒ AmbiguousError
constructor
A new instance of AmbiguousError.
Methods inherited from Error
#exit_code, exit_code_for, #retryable?
Constructor Details
#initialize(resource, matches: []) ⇒ AmbiguousError
Returns a new instance of AmbiguousError.
219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/fizzy/errors.rb', line 219 def initialize(resource, matches: []) @matches = matches hint = if matches.any? && matches.length <= 5 "Did you mean: #{matches.join(", ")}" else "Be more specific" end super( code: ErrorCode::AMBIGUOUS, message: "Ambiguous #{resource}", hint: hint ) end |
Instance Attribute Details
#matches ⇒ Array<String> (readonly)
Returns list of matching resources.
217 218 219 |
# File 'lib/fizzy/errors.rb', line 217 def matches @matches end |