-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ht 3192 enumbug #135
Ht 3192 enumbug #135
Conversation
offending enumchrons listed in https://tools.lib.umich.edu/jira/browse/HT-3192 |
0f83f47
to
b16424d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this fix makes the warning more readable, but it doesn't prevent the underlying problem with the exception being thrown.
To be clear, I don't think we need to make it so that the offending enumchron is parseable in any meaningful way. However, I think we should try to avoid it throwing the undefined method 'gsub!' for nil:NilClass
exception internally. Looking at where that's happening:
holdings-backend/lib/enum_chron_parser.rb
Line 221 in fff71d7
input_str = input_str.gsub!(m[0], "") |
it looks like the issue is that input_str
is nil at that point. I don't really understand how that would happen just looking at the code (in particular I don't understand how a nil string could match the regexp, and I don't understand how the string could end up being transformed into nil), but I do think it's worth tracing that path with an offending enumchron.
The problem is that: input.gsub!("not_in_string","replacement") returns We should change this to either: input_str = input_str.gsub(m[0], "") Or, probably my preference at this point given that we're already mutating input_str.gsub!(m[0], "") There are several other places we're doing the same thing, so we should probably just review all uses of |
Took care of it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🌭
Not a solution to the problem, but a change to make the warnings make more sense.