clarkeash/doorman

Reedem without exceptions

Closed this issue · 3 comments

It would be cool to have a reedem-like exception, but that returns true or false instead of throwing exceptions. I've had a look at the code, and it'd be easy to implement, but I couldn't come up with a namefor the function 🤣

The check method will provide you will a true/false value.

@clarkeash But it doesn't increment the uses. I was asking for a reedem-like function but returning a boolean and without throwing anything.

I don't see it being hard just to catch the DoormanException.

You could even add your own custom function if you wanted:

function redeem($code, $email) 
{
    try {
        Doorman::redeem($code, $email);
        return true;
    } catch (DoormanException $e) {
        return false;
    }
}

I am going to close this out for now as I am failing to see a use case.