Skip to content

Commit 4a24a3a

Browse files
committed
Fix 🐛 with message format
(>ლ) we did the work to convert the ids to arrays, but then in the error message, ignored it. The parameter is `missing_ids` and our ivar is `@missing_ids`, with reader `#missing_ids`. Since the parameter name is the same as the reader, references to the plain `missing_ids` is the parameter not the reader (which would be `self.missing_ids` in this context). Instead of appending `self` and passing messages, this makes the message interpolation use the local ivars. This is acceptable to me as we are still in the constructor. We just set the ivars above and then want to use them directly for the message interpolation. I view this as treating the ivars akin to locals (just pretend that `@` is part of the local var name) for this specific constructor use case.
1 parent 30cf3b9 commit 4a24a3a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/kracken/error.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def initialize(resource, missing_ids)
1717
@missing_ids = Array(missing_ids)
1818
@resource = resource
1919
super(
20-
"Couldn't find #{resource} with id(s): #{missing_ids.join(', ')}"
20+
"Couldn't find #{@resource} with id(s): #{@missing_ids.join(', ')}"
2121
)
2222
end
2323
end

0 commit comments

Comments
 (0)