anomaly / gallagher

The missing toolkit for extending Gallagher Command Centre, featuring a CLI, SQL interface, TUI and a Python idiomatic SDK
https://anomaly.github.io/gallagher/
MIT License
11 stars 2 forks source link

Handle feature not licensed errors #8

Closed devraj closed 2 months ago

devraj commented 1 year ago

Gallagher API licenses features by the piece, if a feature isn't available the server responds with a 403 with the following json:

HTTP/1.1 403 Forbidden
Cache-Control: no-cache
Content-Length: 34
Content-Type: application/json; charset=utf-8
Date: Sat, 10 Jun 2023 05:08:12 GMT

{
    "message": "Feature not licensed"
}

the API client should have the ability to handle these responses and throw an exception

devraj commented 9 months ago

While experimenting with responses to implement #5 I found that the discovery endpoint does not return an endpoint for features not licensed by the instance.

We should depend on the responses being set to None for the particular endpoints and an exception being thrown by the client.

devraj commented 4 months ago

Partially handled by #7

We still need to ensure that we handle this in user interfaces to provide meaningful information to the users.

At an API level the developer is expected to catch and handle this.

Leaving this open until documentation is completed.