simple_segment
simple_segment copied to clipboard
`on_error` is inconsistent with `analytics-ruby`
analiytics-ruby
passes two arguments, while simple_segment passes four, so on_error: ->(status, message) {}
doesn't work.
Hey @ojab, thanks for submitting this! You are correct, this is not backwards-compatible with analytics-ruby. I still feel reluctant about changing the signature to 2 arguments, since at this point this would be a breaking change for this gem 🤔
I'll leave this issue open and might change to a 2-argument on_error in a future 2.x release.
Sure, it's probably easier to change it to 4 argument in analytics-ruby with backward-compatible way. I'm planning to finish some backlog on NY holidays and make/submit some PRs, I'll try to include this.
And if it would be NAKed — we could do this in backward-compatible way in simple_segment by checking error_handler.arity
.