Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Status Codes from Cloud Foundry API V3 #1180

Open
IvanShastakouSAP opened this issue Feb 8, 2023 · 2 comments
Open

Error Status Codes from Cloud Foundry API V3 #1180

IvanShastakouSAP opened this issue Feb 8, 2023 · 2 comments
Labels
question triaged Initial triage of issue has been performed

Comments

@IvanShastakouSAP
Copy link

Hello everyone. Currently I am working on contribution for the get() operation for applicatons. The essence of contrubution is to migrate client implementation from v2 CF APIs to v3. In DefaultApplications Java class this method is used for getting Application details:

private static Mono<ApplicationInstancesResponse> getApplicationInstances(CloudFoundryClient
					cloudFoundryClient, String applicationId) {
	return requestApplicationInstances(cloudFoundryClient, applicationId)
	.onErrorResume(ExceptionUtils.statusCode(CF_BUILDPACK_COMPILED_FAILED, CF_INSTANCES_ERROR, 
	CF_STAGING_NOT_FINISHED, CF_STAGING_TIME_EXPIRED, CF_STAGING_ERROR),
	t -> Mono.just(ApplicationInstancesResponse.builder().build()));
}

Here we see the handling of various errors by their status codes. Method ExceptionUtils.statusCode just checks if at least one of the passed codes to this method matches the code returned from the API of the V2.

In the DefaultApplications defined following status codes:

private static final int CF_APP_STOPPED_STATS_ERROR = 200003;
    private static final int CF_BUILDPACK_COMPILED_FAILED = 170004;
    private static final int CF_INSTANCES_ERROR = 220001;
    private static final int CF_SERVICE_ALREADY_BOUND = 90003;
    private static final int CF_STAGING_ERROR = 170001;
    private static final int CF_STAGING_NOT_FINISHED = 170002;
    private static final int CF_STAGING_TIME_EXPIRED = 170007;

I want to ask a question where the list of these codes was taken from?
(I tried to find them in the CF API V2 documentation but didn't find them unfortunately.).

Also, do we have similar list of errors for CF V3 APIs? If we have could please share with me some sources, where I can find them? (I tried to find them there: https://v3-apidocs.cloudfoundry.org/version/3.131.0/index.html#errors) But it is common information about the errors and there we don't have info about the returning errors for a specific API endpoint.

@dmikusa
Copy link
Contributor

dmikusa commented Feb 8, 2023

Those are CAPI errors. You could try asking on https://github.com/cloudfoundry/cloud_controller_ng/issues or on the Cloud Foundry Slack.

@dmikusa dmikusa added question triaged Initial triage of issue has been performed labels Feb 8, 2023
@IvanShastakouSAP
Copy link
Author

@dmikusa Thanks for the answer.
I asked community there: cloudfoundry/cloud_controller_ng#3180

One of the colleagues said that would be enough to handle common errors defined in the CF API docs: https://v3-apidocs.cloudfoundry.org/version/3.131.0/index.html#common-errors

But I just want to ask you, it is enough for us to handle commons?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question triaged Initial triage of issue has been performed
Projects
None yet
Development

No branches or pull requests

2 participants