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
In general cases, this is not a big deal, but when things like units are returned in the error message, it makes sense to keep the case. For example, when creating a container with a memory limit not in the expected range, the received error is:
scaleway-sdk-go: http error 400 Bad Request: 500 mvcpu require a minimum of 500 mib and a maximum of 2000 mib of memory.
Here, instead of returning MiB (mebibytes), we have mib (millibits?), and that can be confusing.
I've noticed this by running Terraform (which under the hood uses scaleway-sdk-go), but it should be the case for all messages converted by scaleway-sdk-go. Anyway, to reproduce with Terraform, we can use:
resource"scaleway_container_namespace""main" {
name="serverless-example-ns"description="Namespace managed by terraform"
}
resource"scaleway_container""main" {
name="serverless-example-container"description="NGINX container deployed with terraform"namespace_id=scaleway_container_namespace.main.idregistry_image="docker.io/library/nginx:latest"port=80cpu_limit=500memory_limit=400min_scale=0max_scale=1privacy="public"protocol="http1"deploy=true
}
And you should see the error message above (in lower case).
I suggest to avoid the lower case conversion in scaleway-sdk-go, and return directly the message sent by the API. Maybe there is a real explanation of the conversion, so feel free to do whatever the best is.
Thanks :)
The text was updated successfully, but these errors were encountered:
When unmarshaled, messages returned from Scaleway API are converted in lower case, see https://github.com/scaleway/scaleway-sdk-go/blob/v1.0.0-beta.29/scw/errors.go#L54.
In general cases, this is not a big deal, but when things like units are returned in the error message, it makes sense to keep the case. For example, when creating a container with a memory limit not in the expected range, the received error is:
Here, instead of returning
MiB
(mebibytes), we havemib
(millibits?), and that can be confusing.I've noticed this by running Terraform (which under the hood uses
scaleway-sdk-go
), but it should be the case for all messages converted byscaleway-sdk-go
. Anyway, to reproduce with Terraform, we can use:And you should see the error message above (in lower case).
I suggest to avoid the lower case conversion in
scaleway-sdk-go
, and return directly the message sent by the API. Maybe there is a real explanation of the conversion, so feel free to do whatever the best is.Thanks :)
The text was updated successfully, but these errors were encountered: