You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using the MessageBirdClient.sendVoiceCall method to initiate phone calls. We were able to catch exceptions when the voice call request fails. However, we also expected to be able to use the MessageBirdException.getErrors method to pull out the particular error code returned (not just the HTTP status code). Instead, the method returns null.
It looks to me like the issue is here in MessageBirdServiceImpl where the body of the failed HTTP request is mapped onto the ErrorReport[] class. The fields of an error I received when testing the API via cURL ("message", "code") do not match the fields of the ErrorReport class ("description", "code", "parameter"):
{
"errors": [
{
"message": "You're not authorized to access this resource.",
"code": 14
}
]
}
vs
public class ErrorReport {
private Integer code;
private String description;
private String parameter;
...
I am not sure if those fields ErrorReport class are expected elsewhere or with different types of errors. The only one we were able to manually test is when we receive a 403 "unauthorized" for using the incorrect API key.
Hello @akosasante,
Thanks for reporting this issue. I did a quick test. The problem caused because our APIs return back an error with different fields. For example, rest API returns code, description, parameter fields in error object but voice API returns message and code parameters. That's why it cannot parse to ErrorReport object. We will fix this problem.
Hi @akosasante,
Regarding this issue, we have just released version 3.0.8. We added the 'message' field which is not null in voice api results. Thank you and we are welcoming more issues.
We are using the
MessageBirdClient.sendVoiceCall
method to initiate phone calls. We were able to catch exceptions when the voice call request fails. However, we also expected to be able to use theMessageBirdException.getErrors
method to pull out the particular error code returned (not just the HTTP status code). Instead, the method returnsnull
.As per the code here and the status codes outlined in the API docs here: (eg.
25
for "not enough balance").It looks to me like the issue is here in
MessageBirdServiceImpl
where the body of the failed HTTP request is mapped onto the ErrorReport[] class. The fields of an error I received when testing the API via cURL ("message", "code") do not match the fields of the ErrorReport class ("description", "code", "parameter"):vs
I am not sure if those fields ErrorReport class are expected elsewhere or with different types of errors. The only one we were able to manually test is when we receive a 403 "unauthorized" for using the incorrect API key.
(CC: @katchengli)
The text was updated successfully, but these errors were encountered: