Conversation
lib/kmts.rb
Outdated
There was a problem hiding this comment.
Could you factor this validation logic into a separate method? Raising the exception only to be caught locally seems a bit ungainly, though I understand it's necessary given #log_error.
Otherwise, note your regular expression pattern is unanchored and arguably a bit overspecified; I'd suggest /\A\d+\z/ instead. It's also necessary to return after handling the exception, as otherwise the tracking request is still issued. Finally as a very minor style nit, our guide advises against and in favor of &&.
There was a problem hiding this comment.
I could! I thought that since its only going to be used right here, bringing it out would be overkill.
Totally agree about the raise here, I am not happy about it but I am working with the patterns in here.
Good calls on the rest, thanks for spotting it!
|
Couldn't hurt as a defensive play, though at the same time I'd be comfortable leaving that piece untouched. |
Adds validation to
_tvalues, ensuring that the values are valid unix timestamps.