Conversation
| processed_action = @before_send.call(action) | ||
|
|
||
| if processed_action.nil? | ||
| logger.warn("Event #{action[:event]} was rejected in beforeSend function") | ||
| elsif processed_action.empty? | ||
| logger.warn("Event #{action[:event]} has no properties after beforeSend function, this is likely an error") | ||
| end | ||
|
|
||
| processed_action |
There was a problem hiding this comment.
Maybe we need a begin/rescue here to avoid problems with the @before_send call failing. We can then return nil in that case
There was a problem hiding this comment.
wasn't sure whether to use original or drop on error...
There was a problem hiding this comment.
went to check JS SDK and that would explode back at the user 🫠
There was a problem hiding this comment.
It's less bad on JS because capture is usually called on useEffects and stuff, but it's much worse in the server where we'll just crash their entire process
| # returns Boolean of whether the item was added to the queue. | ||
| def enqueue(action) | ||
| action = process_before_send(action) | ||
| return false if action.nil? || action.empty? |
There was a problem hiding this comment.
technically this is a breaking change
but if someone was relying on the fact that we would enqueue empty objects then 🤷
There was a problem hiding this comment.
think that's all right. Is this going on the Ruby 3+ branch or the previous version?
There was a problem hiding this comment.
well, felt mean to just put it on 3.x since it doesn't depend on the ruby version change
so we can ship in both and then if someone wants something more from it they have to update
Co-authored-by: Rafael Audibert <32079912+rafaeelaudibert@users.noreply.github.com>
Co-authored-by: Rafael Audibert <32079912+rafaeelaudibert@users.noreply.github.com>
and since I'm here let's add
before_sendto the lib...would help with e.g. #49