Boavizta / boaviztapi

🛠 Giving access to BOAVIZTA reference data and methodologies trough a RESTful API
GNU Affero General Public License v3.0
66 stars 23 forks source link

API returns error 500 if cloud instance type is not in the dataset. #83

Closed demeringo closed 1 year ago

demeringo commented 2 years ago

Bug description

If I query API for cloud impacts for an instance-type that has no data in the API dataset, the API returns Error 500.

To Reproduce

Query the API (https://api.boavizta.org/docs#/cloud/instance_cloud_impact_v1_cloud_aws_post) with one of theses instance types :

Expected behavior

Not sure what we should return, this issue is more to open the discussion:

Additional context

Not a critical bug IMHO, but raises the question of which error / status codes we would like to have globally for API behavior.

When writting a client, we still have the ability to avoid this error by pre-checking if the givent instance type is supported (see https://api.boavizta.org/docs#/cloud/server_get_all_archetype_name_v1_cloud_aws_all_instances_get)

da-ekchajzer commented 2 years ago

We have implemented an HTTP 404 error when the instance is not given with the following answer :

{
  "detail": "a1.4 not found"
}

Would this be ok for your use case ? If so it will be available in the v0.2

da-ekchajzer commented 1 year ago

Implemented in https://github.com/Boavizta/boaviztapi/issues/83