whatsapp-business-java-api
whatsapp-business-java-api copied to clipboard
WhatsappApiException not expose the status code
Sorry for the late reply @Bindambc,
I can modify the class
WhatsappApiExceptionby adding a method calledgetWhatsappApiError()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