Closed PuruVJ closed 3 years ago
@PuruVJ What are the other error codes? Based on that we can come up with user friendly error messages.
500 - Sorry, our server is having issues. Please come back later 400 - Bad Request, possibly some useful information on what's wrong with the request. 401 - You're not authorized to access the app
@Mira-Alf @johnjacobkenny @proful
Yeah, I think that this list looks good to start off with. In addition, we should handle any that the twitter API tells us to.
Looks good
However these are RESTful error codes. Relevant to CLI?
I don't remember any CLI throw or display these kind of errors.
As long as we use internally I am fine but we need to translate human readable error message to the CLI user.
I'm thinking of errors like Invalid Bearer token, or unknown tweet, or something like that. The REST error codes can be answered with the NetworkError itself
Mira is looking into it and will share her findings
{ "errors": [ { "detail": "Could not find tweet with ids: [1320717377537929217].", "title": "Not Found Error", "resource_type": "tweet", "parameter": "ids", "value": "1320717377537929217", "type": "https://api.twitter.com/2/problems/resource-not-found" } ], }
The question now is should we classify all non 200 error codes returned by Twitter under a single error? Does it make sense to have too much detail? Like for example in the original message by @PuruVJ he had used "haha" as tweet id and that will throw a 400 error code. What information must be displayed to the user? Throwing a network issue does not make much sense in this case.
Inputs appreciated.
@Mira-Alf Thanks. I've implemented most of these by testing the API with different paramters. Expect a PR soon.
Great @PuruVJ Thanks!
Is this issue resolved fully? Can it be closed?
twitter/api/helpers/fetch.js has this code
If the request fails, it throws the error that there's an error in the network, CHeck your network, etc. But it would give same error if the ID is invalid
How do we tackle this @Mira-Alf @johnjacobkenny?