Description
In org.zstack.sdk.ZSClient.pollResult, the guard throws an error whose
message reads:
throw new ApiException(String.format("[Internal Error] the api[%s] is not an async API but" +
" the server returns 201 status code", action.getClass().getSimpleName()));
However, pollResult is only invoked from doCall when the server responds
with 202:
} else if (response.code() == 202) {
if (config.webHook != null) {
return webHookResult();
} else {
return pollResult(response);
}
}
The message mentions 201, which does not match the 202 that actually
routes into this path, so the error is misleading when it occurs.
Expected behavior
The error message should reference the status code that actually leads here.
Proposed fix
" the server returns 202 status code", action.getClass().getSimpleName()));
Description
In
org.zstack.sdk.ZSClient.pollResult, the guard throws an error whosemessage reads:
However,
pollResultis only invoked fromdoCallwhen the server respondswith
202:The message mentions
201, which does not match the202that actuallyroutes into this path, so the error is misleading when it occurs.
Expected behavior
The error message should reference the status code that actually leads here.
Proposed fix