Skip to content

[ZSvirt] bug: sdk: pollResult error message says 201 but it is only called on 202 #50

Description

@chayu163

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()));

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions