Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Handler #2

Closed
Wallvon opened this issue Dec 18, 2019 · 3 comments
Closed

Error Handler #2

Wallvon opened this issue Dec 18, 2019 · 3 comments
Assignees

Comments

@Wallvon
Copy link

Wallvon commented Dec 18, 2019

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 gives 400 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)

@iamkubi
Copy link
Owner

iamkubi commented Dec 18, 2019

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.

@iamkubi iamkubi self-assigned this Dec 18, 2019
@iamkubi
Copy link
Owner

iamkubi commented Mar 21, 2020

Added handling for 400 errors in b5ed19f. 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.

@iamkubi
Copy link
Owner

iamkubi commented Mar 21, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants