Comments (5)
The API return two structs, one is response, the other one is err. Would the err works for you?
func (client ComputeClient) AttachVolume(ctx context.Context, request AttachVolumeRequest) (response AttachVolumeResponse, err error)
from oci-go-sdk.
The status code of the request is not easily extracted from the error. This used to be available in the response, but it seems like there was an API change. Is this documented anywhere to explain why this has happened and what is the recommended way of extracting the status code in the case of an error. Is this a bug or a feature?
from oci-go-sdk.
@MadalinaPatrichi. You have a couple of options
- All API respond with an struct and an error type. The error could be an
ServiceError
in that case you can access the http status code from the type via theGetHTTPStatusCode()
. There are other methods in theServiceError
interface you can use. Additionally if the response is not nil, allxxxResponse
structs contain theRawResponse
field of typehttp.Response
where you can inspect all the details of an http response. - When the response is nil, then the error is not of type
ServiceError
and usually means that an error happened before we could execute the network call, errors in the network, marshalling errors, etc fall under that category. Those errors obviously won't have a status code.
You can see some examples of error handling here: https://github.com/oracle/oci-go-sdk/blob/master/example/example_core_test.go#L369
By the sounds of it, it seems like the error you are getting might be client related, and for the record the API to deal with these issues has not changed. Out of curiosity what is the value of your err.String()
from oci-go-sdk.
@MadalinaPatrichi , please let us know if you are still having the issue or not, otherwise, we are going to close it, thanks!
from oci-go-sdk.
@MadalinaPatrichi I am closing this issue, please let us know if you still have questions, thanks!
from oci-go-sdk.
Related Issues (20)
- OkeWorkloadIdentityConfigurationProvider example HOT 1
- Operation fails with NotAuthorizedOrNotFound but same operation succeeds when using CLI HOT 7
- SDK testability and mocks HOT 5
- `UploadRequest` creates `ObjectStorageClient` when uploading request is processing. HOT 1
- Unable to retrieve actual object storage bucket size HOT 4
- Retry policy does not retry ephemeral network errors HOT 6
- Token not present in Identity Domains' `CreateAuthTokenResponse` and `CreateMyAuthTokenResponse` HOT 6
- missing LaunchOptions in CreateImageDetails struct HOT 3
- ListExternalContainerDatabases is not returning list of all databases in that region HOT 3
- Support MappedAttributes for IdentityDomains HOT 3
- Support Policies for Identity Domains HOT 1
- Support Rules for Identity Domains HOT 1
- Issue with endpoint - Oracle Queue HOT 4
- The API `ListInstances`of `ComputeClient` does not return any value for the attribute `PlatformConfig` HOT 10
- encrypted PKCS#8 API private keys are not supported HOT 1
- The API `ListInstances` of `ComputeClient` returns `TLS handshake timeout` error with large number of result set.
- Stream client's PutMessages() doesn't fully utilize retry policies. HOT 1
- ERROR: LaunchInstance HOT 1
- OkeWorkloadIdentityConfigurationProvider looking for OCI_RESOURCE_PRINCIPAL_VERSION environment HOT 2
- support the same environment variables as the CLI HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oci-go-sdk.