Closed Synchro closed 1 year ago
yes, after i deleted the default api keys in my sandbox account, i always got the "Braintree\Exception\Authentication" 401 error.
👋 @synchro, thanks for reaching out. I'm going to forward this feedback to the engineering team that determines authorization for review. This definitely presents a scenario where the SDK is surfacing an Authorization error but the underlying issue (merchant account) isn't getting surfaced in the error response for the SDK to surface.
Since the underlying root of the issue is on the API response and not the SDK itself, I'm going to go ahead and close this.
General information
Issue description
I have an integration issue, but I could not track down the cause because the SDK omits critical information.
Sample code:
I was certain that that the credentials were correct because the call to
customer->find()
worked, but this code throws an Authorization exception, which is exceedingly unhelpful:Note that it contains no contextual information at all. So I spent a long time trying to figure out what was wrong, mainly (since this was Authorization, after all) looking at roles and permissions. Eventually it occurred to me that I should check all my inputs, so I called:
Which gave me the enormously helpful:
So my request here is to have that exception thrown (or at least some contextual info to hint at the cause) in the exception thrown from sale. I'd say the right way to do this is to throw the existing
Braintree\Exception\Authorization
exception, but include the previousBraintree\Exception\NotFound
exception inside it so you don't break BC, but can get at the extra info by callinggetPrevious()
on the outer exception – which is not currently being used.