Exceptions
HTTP requests returning an unsuccessful status code will raise:
ansys.dcs.client.ClientError
for client errors (4xx status code, e.g. bad syntax or not found)ansys.dcs.client.APIError
for server errors (5xx status code, e.g. internal server error or not implemented)
All exceptions that the Ansys DCS clients explicitly raise inherit from ansys.dcs.client.DCSError
.
- exception ansys.dcs.client.DCSError(*args, **kwargs)
Base class for all ansys-dcs-client related errors. Derives from
requests.exceptions.RequestException
.Example
>>> from ansys.dcs.client import DCSError >>> from ansys.dcs.client.dps import Client >>> try: >>> client = Client(dcs_url="https://127.0.0.1/dcs/", username="dcadmin", password="wrong_psw") >>> except DCSError as e: >>> print(e) 400 Client Error: invalid_grant for: POST https://127.0.0.1/dcs/auth/api/oauth/token Invalid "username" or "password" in request.
- exception ansys.dcs.client.APIError(*args, **kwargs)
Indicate server side related errors.
- exception ansys.dcs.client.ClientError(*args, **kwargs)
Indicate client side related errors.