is there any way to get more information from a fa...
# support
j
is there any way to get more information from a failed order transition than
State cannot transition via "next"
j
You can call
errors
on the order to get the reason.
j
ahhhh, nice! will try that thank you
sg horns 1
Copy code
@errors=[#<ActiveModel::Error attribute=state, type=invalid_transition, options={:event=>"next", :state=>"confirm", :message=>nil}>]>
hmm, no dice, will consider looking into how we could add this
j
You're trying to transition from
confirm
to
complete
? You probably want
complete
rather then
next
then.
That error is telling you that there's no transition from
confirm
to anything via
next
j
i've got some funky behavior i haven't been able to track down of users trying to complete orders and being redirect to payment with no flash message -- so i'm more so just trying to get some visibility by adding a hook like:
Copy code
unless Rails.env.development? || Rails.env.test?
      rescue_from StateMachines::InvalidTransition,
                  with: :handle_order_transition_error
    end
so just was triggering some dummy failures locally with the hopes i'll get some visibility if it happens in production
totally possible when it really happens we'll get a really message
that makes sense though, invalid transition IS the error
e
Once I found an edge case where the customer had the confirm step bookmarked and go there directly whenever they wanted to checkout
💀 3
s
@Edwin Cruz Customers will often times do this to check status of order. This causes analytics issues when firing conversion tracking as well
j
Conversion tracking should be set up using the flash to only render when arriving there from checkout. Subsequent arrivals shouldn't trigger analytics conversions if everything is set up correctly.
s
@Jared Norman Yea we learned the "if everything is set up correctly" part a while ago. Just was making note more so this behavior is fairly common for customers
sg thumbs up 1