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

Fix typo preventing access to response object on error #62

Merged
merged 1 commit into from
Jul 23, 2019

Conversation

jmondo
Copy link
Contributor

@jmondo jmondo commented Jul 22, 2019

No description provided.

@jmondo
Copy link
Contributor Author

jmondo commented Jul 22, 2019

The same tests are failing on master branch

CHANGELOG.md Outdated
@@ -1,6 +1,6 @@
### 0.3.5 (Next)

* Your contribution here.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you bring this back to the CHANGELOG? This way new contributors will be able to easily see that a new entry should be added here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad!

@@ -1,7 +1,7 @@
module Graphlient
module Errors
class GraphQLError < Error
attr_reader :responsee
attr_reader :response
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this is a just typo, this is technically a breaking change and could break existing users and it should ho through the deprecation cycle.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point. is there a deprecation guide? i know i should add back the old attr_reader but is there any particular way i should mark this for deprecation?

Copy link
Collaborator

@yuki24 yuki24 Jul 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we follow semver in terms of versioning. Then the old method could output a warning when called:

class GraphQLError < Error
  attr_reader :response

  ...

  def responsee
    warn "The `#responsee' method is deprecated since it has a typo. Please use the `#response' method instead."

    response
  end
end

@ashkan18 Is this something you would like to do? Do you have any preferences?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a deprecation notice. i returned @responsee though (always nil) since that was the old behavior.

Copy link
Collaborator

@yuki24 yuki24 Jul 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I did not notice that it always returns nil. That means it is less likely that people actually are using it and we do not have to worry about compatibility. I am sorry for the back and forth, but would you just remove it? Renaming should just be fine.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yuki24 we can leave it deprecated for now since @jmondo has already did deprecation, i can remove it later.

warn "The `#responsee' method is deprecated since it has a typo. Please use the `#response' method instead."

@responsee
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you have meant to add this to lib/graphlient/errors/graphql_error.rb.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, thanks. my multitasking isn't going too well here ;)

@ashkan18
Copy link
Owner

thanks @jmondo for 👀 , I fixed the issue on master the issue was, on newer ruby versions Travis was using a newer 1.9.7 version of graphql which we use for tests. Ended up fixing it by setting graphql version for tests in Gemfile.
When had a chance, rebase with master and we can merge.

@jmondo
Copy link
Contributor Author

jmondo commented Jul 22, 2019

@ashkan18 looks like we're green!

@ashkan18 ashkan18 merged commit 3460b5e into ashkan18:master Jul 23, 2019
@ashkan18
Copy link
Owner

thanks @jmondo for your contribution 💜

ashkan18 added a commit that referenced this pull request Jul 23, 2019
ashkan18 added a commit that referenced this pull request Jul 23, 2019
ashkan18 added a commit that referenced this pull request Jul 23, 2019
ashkan18 added a commit that referenced this pull request Jul 23, 2019
ashkan18 added a commit that referenced this pull request Jul 23, 2019
@ashkan18
Copy link
Owner

just cut 0.3.6 with this change 🙌

@jmondo
Copy link
Contributor Author

jmondo commented Jul 23, 2019 via email

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

Successfully merging this pull request may close these issues.

3 participants