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

Throw an error when environmental root directory is missing #35

Open
kchresfield opened this issue Oct 10, 2019 · 0 comments
Open

Throw an error when environmental root directory is missing #35

kchresfield opened this issue Oct 10, 2019 · 0 comments

Comments

@kchresfield
Copy link

kchresfield commented Oct 10, 2019

Describe the bug
If the environment root directory is not found, no error is thrown it exits out without a message

To Reproduce
Steps to reproduce the behavior:

  1. In the controller/projects file, set the rootDirectory variable to a root path that does not exist.
    let rootDirectory = `${home()}/environment`;
  2. fs.readdirSync(${rootDirectory}/) resolves to undefined, code does not break or error thrown.
    githubDir = fs.readdirSync(`${rootDirectory}/`)

Expected behavior
Expected an error to be printed to the console or terminal

Desktop (please complete the following information):

  • OS: iOS
  • Browser: Chrome
  • Version: Chrome 77, ospark 3.1.0

Additional context
Can be resolved with a try and catch. Wrapping the githubDir variable in a try and an error in a catch.

else if (codenvyUser) {
  rootDirectory = codenvyUser;
  try {
    githubDir = fs.readdirSync(`${rootDirectory}/`)
      .filter(dir => /[\w]+\.github\.io/.test(dir))[0];
  } catch (err) {
    console.log(err);
  }
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

1 participant