Skip to content
This repository has been archived by the owner on Nov 30, 2020. It is now read-only.

Code quality - Possible unreachable statement #3

Open
gsilvapt opened this issue Apr 7, 2018 · 0 comments
Open

Code quality - Possible unreachable statement #3

gsilvapt opened this issue Apr 7, 2018 · 0 comments

Comments

@gsilvapt
Copy link
Contributor

gsilvapt commented Apr 7, 2018

I would like to discuss the possibility of an unreachable statement in the http module:

class HttpApi {
  constructor(options) {
    if (options) {
...
    }
// What I'm interested in discussing:
    if (!this.host)
      throw Error("Host option is required.");
  }

This is line 38 of the file. When can this be reached if there no possibility of creating an empty HttpApi object? Even when we do new HttpApi({host: ""}) it will return the previous error defined with invalid host url.
If you can help me understand when this if statement is reached, I can potentially add one more test to it to make sure this line is covered.

Thanks in advance for your help.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant