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

Obsolete type GraphQLHTTPResponseError #1425

Closed
knox opened this issue Sep 30, 2020 · 9 comments
Closed

Obsolete type GraphQLHTTPResponseError #1425

knox opened this issue Sep 30, 2020 · 9 comments

Comments

@knox
Copy link

knox commented Sep 30, 2020

Bug report

With the new network stack (yeah!) a few types such as GraphQLHTTPResponseError became obsolte but did not get removed from code base yet.

Versions

  • apollo-ios SDK version: 0.34.0

Steps to reproduce

"Find usages" of GraphQLHTTPResponseError, GraphQLHTTPRequestError and probably others.

@designatednerd
Copy link
Contributor

GraphQLHTTPRequestError is still used, but good catch on the response error.

Please note that "find usages" isn't the be-all, end-all, especially for enum types - always worth doing a text search through the full codebase.

@knox
Copy link
Author

knox commented Oct 1, 2020

The problem here for me was that by not beeing broken because of a removed class my validations got semantically broken because they where still checking for that type.

Of course you're right about GraphQLHTTPRequestError. I've mistaken that.

But still, regarding your advise to check for "usages" with full text search i have to strongly disagree. In fact i heavily rely on this kind of type based analysis and navigating through code and therefore i prefer AppCode over Xcode a lot because of it outstanding capabilities in that. You should give it a try.

@knox knox changed the title Obsolete types GraphQLHTTPResponseError et. al. Obsolete type GraphQLHTTPResponseError Oct 1, 2020
@designatednerd
Copy link
Contributor

designatednerd commented Oct 1, 2020

I agree that it's helpful, but particularly when it comes to removing stuff, I've found it better to belt-and-suspenders things by actually searching out where something is used (even in AppCode, which I have used before).

@designatednerd
Copy link
Contributor

This has been removed with 0.35.0. If you find other unused types, please open a new issue. Thanks!

@Max-Job
Copy link

Max-Job commented Nov 26, 2020

how I can handle server error?

@knox
Copy link
Author

knox commented Nov 26, 2020

Try something like this

        if case .invalidResponseCode(let response, _) = error as? ResponseCodeInterceptor.ResponseCodeError,
              let httpResponse = response {
            print(httpResponse.statusCode)
        }

@Max-Job
Copy link

Max-Job commented Nov 26, 2020

@knox oh! thank you so much! it works for me)
but now I have another problem:
if environment (API URL) doesn't exist it's not working

@Max-Job
Copy link

Max-Job commented Nov 26, 2020

if I write incorrect url here, I cannot handle error and get status code

let transport = RequestChainNetworkTransport(interceptorProvider: provider,
                                                     endpointURL: url)
        return ApolloClient(networkTransport: transport, store: store)

@designatednerd
Copy link
Contributor

@Max-Job Could you please open this as a different issue and provide more details like:

  • What type of error are you expecting to receive in this instance?
  • What is the type of error which you do receive?

manicmaniac added a commit to manicmaniac/ApolloDeveloperKit that referenced this issue Jun 2, 2021
See apollographql/apollo-ios#1425,
which affects on not only 0.35.0 but 0.34.0.
manicmaniac added a commit to manicmaniac/ApolloDeveloperKit that referenced this issue Jun 2, 2021
See apollographql/apollo-ios#1425,
which affects on not only 0.35.0 but 0.34.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants