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

doctor: add error messages for failures #672

Merged

Conversation

jmeistrich
Copy link
Contributor

Summary:

This adds error messages for failing checks.

@thymikee
Copy link
Member

@jmeistrich can I ask you to rebase? We've added types to doctor command and now conflicts arisen

@thymikee thymikee changed the title add error messages for failures doctor: add error messages for failures Sep 10, 2019
@thymikee
Copy link
Member

CI is failing because of known race conditions (with yet unknown cause) in config test

@thymikee thymikee merged commit 154f1ca into react-native-community:master Sep 10, 2019
@thymikee
Copy link
Member

Thank you!

@jmeistrich
Copy link
Contributor Author

Happy to help!

}) => {
const symbol = needsToBeFixed
? isRequired
? chalk.red('✖')
: chalk.yellow('●')
: chalk.green('✓');

logger.log(` ${symbol} ${label}`);
logger.log(` ${symbol} ${label}${needsToBeFixed ? ': ' + description : ''}`);
Copy link
Member

Choose a reason for hiding this comment

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

@jmeistrich @thymikee: what's the reason for adding this?

With this change, this is how it looks:

image

Copy link
Member

Choose a reason for hiding this comment

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

That's the reason – to show why the check failed. We treat it as first pass, feel free to iterate on how to present it better :)

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps it would be nice to show this only with --verbose?

Copy link
Member

Choose a reason for hiding this comment

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

Nah, why hiding the reason behind failure? Running doctor again may take some time as well.

Copy link
Member

Choose a reason for hiding this comment

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

Good point.

I would like to, at least, get rid of should be installed as there isn't much being provided there, thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

You mean that each health check file can provide its own description?

Copy link
Member

Choose a reason for hiding this comment

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

Something like this could be added to getDiagnostics() output. Currently needsToBeFixed can be a boolean or string. But we could make it a bit more explicit and add extra information like error message/descirption. Or we can keep the current behavior and only do something like:

  getDiagnostics: async () => ({
    needsToBeFixed: await checkSoftwareInstalled('pod') || "custom message",
  }),

Copy link
Member

Choose a reason for hiding this comment

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

If I got what you mean right, it would be nice to do:

  getDiagnostics: async () => ({
    description: 'required for installing dependencies',
    needsToBeFixed: await checkSoftwareInstalled('pod'),
  }),

Is that it?

Copy link
Member

Choose a reason for hiding this comment

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

Could be, I'm ok with that.

Copy link
Member

Choose a reason for hiding this comment

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

Cool, I'm finishing up some stuff to open a PR, will update #694 with that to refactor it, thanks @thymikee.

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