You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I came across a situation where coercion blows up with a nasty and cryptic error:
1) Hashie::Extensions::Coercion#coerce_key nesting coeces nested objects
Failure/Error: Unable to find matching line from backtrace
SystemStackError:
stack level too deep
# ./lib/hashie/extensions/coercion.rb:14
I found it while working on coercions for core types, but I verified the problem exists on master.
Remove include Hashie::Extensions::Coercion from the subclasses so it's only in BaseCoercableHash.
That's more DRY anyways, but I don't think it's illegal to include the same module twice... in fact I just tested and you can also create this error by including Hashie::Extensions::Coercion twice in the base class, while including Hashie::Extensions::MergeInitializer twice doesn't cause a problem.
Solution?:
Ideally this code should work, or at least raise a more useful specific error.
If that's not possible it could just be documented as a known issue.
The text was updated successfully, but these errors were encountered:
Problem:
I came across a situation where coercion blows up with a nasty and cryptic error:
I found it while working on coercions for core types, but I verified the problem exists on master.
Test:
Workaround:
Remove
include Hashie::Extensions::Coercion
from the subclasses so it's only inBaseCoercableHash
.That's more DRY anyways, but I don't think it's illegal to include the same module twice... in fact I just tested and you can also create this error by including
Hashie::Extensions::Coercion
twice in the base class, while includingHashie::Extensions::MergeInitializer
twice doesn't cause a problem.Solution?:
Ideally this code should work, or at least raise a more useful specific error.
If that's not possible it could just be documented as a known issue.
The text was updated successfully, but these errors were encountered: