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

Exception classes #33

Open
Jxck-S opened this issue May 24, 2023 · 2 comments
Open

Exception classes #33

Jxck-S opened this issue May 24, 2023 · 2 comments

Comments

@Jxck-S
Copy link
Contributor

Jxck-S commented May 24, 2023

Something I believe I need to work on is exception classes. The reason I bring this up is. Lately, I was getting 400's turns out BlueSky has an image size limit. {"error":"BlobTooLarge","message":"This file is too large. It is 1.1MB, but the maximum size is 976.56KB."} The easiest thing to do I believe, is a generic ATProtoException class then raise it whenever error is present in the JSON response. raise ATProtoException (rsp.json()['error']). I'm assuming we should also raise for generic HTTP/connection errors. Let me know if you would like this.

@MarshalX
Copy link

MarshalX commented May 24, 2023

Hi! This is how you can deal with it in atproto SDK

In the exception, you have access to the Response instance that includes the response status code, response headers, and content! Content could be automatically parsed into XrpcError!

image

@Jxck-S
Copy link
Contributor Author

Jxck-S commented Jul 5, 2023

Hi! This is how you can deal with it in atproto SDK

In the exception, you have access to the Response instance that includes the response status code, response headers, and content! Content could be automatically parsed into XrpcError!

image

I was going to say I wanted to stick with atprototools as I already integrated it. But your project has much more work so I'll likely switch to it.

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