whatsapp-business-java-api icon indicating copy to clipboard operation
whatsapp-business-java-api copied to clipboard

WhatsappApiException not expose the status code

Open pcomp96 opened this issue 2 years ago • 0 comments

Sorry for the late reply @Bindambc,

I can modify the class WhatsappApiException by adding a method called getWhatsappApiError() that will allow obtaining the error object. Within the error object, you will be able to check the error codes sent by WhatsApp API.

Yes is perfect because the class WhatsappApiException return only the message of the exception throwed from API.

I could also return the HTTP code, but I'm not sure if it would be helpful. Note that in the case of media not found, the HTTP code is 400.

I think that is the best way to register the HTTP status code in the WhatsappApiError and expose it with public int getHttpStatusCode().

I hope that is useful 😀.

Thanks, Giuseppe.

Originally posted by @pcomp96 in https://github.com/Bindambc/whatsapp-business-java-api/issues/107#issuecomment-1685826059

pcomp96 avatar Aug 25 '23 13:08 pcomp96