Closed Wallvon closed 4 years ago
I've started on a change for this that so far returns the full response when the status code isn't 200. I'll try to add something to surface the 400 and 422 errors better.
Added handling for 400 errors in https://github.com/iamkubi/pydactyl/commit/b5ed19f97e050294185a9641e06572cc6242c482. I'll try to expand on this but haven't had much opportunity to test it, so if you have examples of other errors you'd like to see handled create an issue with an example request and/or the full response and I'll try to add something.
You can find this example now in the README:
client.servers.create_server(name='My Paper Server', user_id=1, nest_id=1,
egg_id=3, memory_limit=8000, swap_limit=0,
disk_limit=0, location_ids=[199])
Traceback (most recent call last):
File "<input>", line 6, in <module>
File "D:\code\pydactyl\pydactyl\api\servers.py", line 268, in create_server
mode='POST', data=data, json=False)
File "D:\code\pydactyl\pydactyl\api\base.py", line 98, in _api_request
'code'], errors['detail'])
pydactyl.exceptions.PterodactylApiError: Bad API Request(400) - NoViableNodeException - No nodes satisfying the requirements specified for automatic deployment could be found.
I am using
client.servers.create_server(name='test server', user_id=1, nest_id=2, egg_id=9, memory_limit=0, swap_limit=0, disk_limit=0, location_ids=[1])
what should work, but I keep getting 400 errors, but I can't seem to find how to fix it because the error handler only gives400 client error
and nothing else. I'd suggest editing the error handler so it says what is wrong. (you also may know me from Discord, That Guy#5275)