in reply to Re: EyeBall stumps BodBall
in thread EyeBall stumps BodBall (Error Handling)

The modules set error in any error. The modules provide the success method which returns true on success or false if there was an error. The user of the module is expected to check success. The error method returns the error value so that the user can understand why success is false.

I see most of your Business::Stripe::Webhook module's methods begin by clearing the module error property via:

$self->{'error'} = '';
presumably to avoid confusion from a spurious error property set by an earlier method call. Is that right?

I also noticed your get_subscription method does not do this. Is this a bug?

In case it helps, another minor issue I noticed is the return value of your check_signature method is not documented. Examining the code indicates it can return 1 or 0 or undef. It would be good to document this method's return value and the difference between returning 0 and undef.

Replies are listed 'Best First'.
Re^3: EyeBall stumps BodBall
by Bod (Parson) on Jul 23, 2023 at 21:07 UTC
    presumably to avoid confusion from a spurious error property set by an earlier method call. Is that right?

    Spot on...

    I also noticed your get_subscription method does not do this. Is this a bug?

    Well spotted, yes it is a bug. It has been corrected in my code locally. Although I suppose I should have done that on GitHub!

    In case it helps, another minor issue I noticed is the return value of your check_signature method is not documented

    It helps a lot thank you.
    As it says in the documentation, there shouldn't be any need to call this method. Originally I was going to have it as a private method but decided that there may be a use case for checking Stripe signatures outside of the workflow that's documented. So, in the end it became a public method.

    The return values have now been added to POD in my local copy.

      > It helps a lot thank you

      You're welcome Bod. Always looking out for you.

      In fact, I've just received an urgent alert that a small red car has been swallowed up by a huge sinkhole in Coventry UK -- Bod, I urge you to avoid the Sewall Highway if you possibly can (hope it wasn't your car in the sinkhole :)

        In fact, I've just received an urgent alert that a small red car has been swallowed up by a huge sinkhole in Coventry UK

        It just shows what a connected world we live in that I get local news from the other side of the world!!!

        I live on the other side of the city to this incident. However, my blind uncle lives very close to there...the one for whom I wanted to know about Controlling USB on Raspberry Pi

        Of course, it's not his car either...😎 - although he has driven a tank!!!