Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

TheGraph Connector: Parse subgraph URL in GraphQLWrapper to catch invalid URLs#47

Merged
Evalir merged 2 commits intomasterfrom
add-graphqlwrapper-url-error
Jun 17, 2020
Merged

TheGraph Connector: Parse subgraph URL in GraphQLWrapper to catch invalid URLs#47
Evalir merged 2 commits intomasterfrom
add-graphqlwrapper-url-error

Conversation

@Evalir
Copy link
Copy Markdown
Contributor

@Evalir Evalir commented Jun 17, 2020

From version 0.1 to 0.2 we had a behavior change with urql as it now errors silently if it doesn't have an URL to work with, leading the library to throw a very obscure cannot read property replace of undefined. This PR detects if there's no URL passed in, or if it's not valid (doesn't contain http, as we're assuming this down below for creating subscriptions) and throws an error with a more meaningful description.

We could also start thinking about making our own errors, extending them from the Error class, akin to how web3-react handles this.

@Evalir Evalir requested review from 0xGabi and bpierre June 17, 2020 12:10
@Evalir Evalir self-assigned this Jun 17, 2020
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 17, 2020

Codecov Report

Merging #47 into master will increase coverage by 0.05%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #47      +/-   ##
==========================================
+ Coverage   28.10%   28.15%   +0.05%     
==========================================
  Files          53       53              
  Lines         861      863       +2     
  Branches      145      146       +1     
==========================================
+ Hits          242      243       +1     
- Misses        619      620       +1     
Flag Coverage Δ
#unittests 28.15% <50.00%> (+0.05%) ⬆️
Impacted Files Coverage Δ
...ckages/connect-thegraph/src/core/GraphQLWrapper.ts 43.39% <50.00%> (+0.25%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5790304...a5ab56c. Read the comment docs.

Copy link
Copy Markdown
Contributor

@bpierre bpierre left a comment

Choose a reason for hiding this comment

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

💯

Comment thread packages/connect-thegraph/src/core/GraphQLWrapper.ts Outdated
Co-authored-by: Pierre Bertet <hello@pierre.world>
@Evalir Evalir merged commit 0bd261f into master Jun 17, 2020
@Evalir Evalir deleted the add-graphqlwrapper-url-error branch June 17, 2020 12:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants