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

Revise error messages to include Linux debugging help #220

Merged
merged 3 commits into from
Apr 3, 2021
Merged

Revise error messages to include Linux debugging help #220

merged 3 commits into from
Apr 3, 2021

Conversation

benholmen
Copy link
Contributor

I just set up Takeout on Ubuntu 20.04 and I'm really pleased - thank you! I ran into a couple of errors and have some suggestions to provide more helpful error messages to Linux users.

$console->line('Start the Docker service:');
$console->line(' sudo systemctl start docker');

if (! $environment->userIsInDockerGroup()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not crazy about this logic in the exception. However, I decided not to throw a unique exception when a user is not in the docker group because it's possible that some environments don't require it. I wanted this message to be a suggestion for why the docker info command is failing, not a requirement to use Takeout.

Copy link
Member

Choose a reason for hiding this comment

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

Totally get that.

Copy link
Member

@mattstauffer mattstauffer left a comment

Choose a reason for hiding this comment

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

Great work on this, thanks!

$console->line('');

if ($environment->isLinuxOs()) {
$console->line('Verify that the Docker service is running:');
Copy link
Member

Choose a reason for hiding this comment

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

Could we move Linux, Windows, and Mac into their own protected methods? That'll start to make this a bit more manageable.

$console->line('Start the Docker service:');
$console->line(' sudo systemctl start docker');

if (! $environment->userIsInDockerGroup()) {
Copy link
Member

Choose a reason for hiding this comment

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

Totally get that.


protected function helpForDarwin()
{
$console = app('console');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mattstauffer is there a way to avoid resolving this in every method?

Copy link
Member

Choose a reason for hiding this comment

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

Yep! As with my suggestions, pass $console into the method call, and then accept it in each function definition

Copy link
Member

@mattstauffer mattstauffer left a comment

Choose a reason for hiding this comment

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

Just quick formatting changes, then we're good. Thanks!

app/Exceptions/DockerNotAvailableException.php Outdated Show resolved Hide resolved
app/Exceptions/DockerNotAvailableException.php Outdated Show resolved Hide resolved

protected function helpForDarwin()
{
$console = app('console');
Copy link
Member

Choose a reason for hiding this comment

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

Yep! As with my suggestions, pass $console into the method call, and then accept it in each function definition

app/Exceptions/DockerNotAvailableException.php Outdated Show resolved Hide resolved
app/Exceptions/DockerNotAvailableException.php Outdated Show resolved Hide resolved
app/Exceptions/DockerNotAvailableException.php Outdated Show resolved Hide resolved
Co-authored-by: mattstauffer <[email protected]>
@benholmen
Copy link
Contributor Author

Refactored to pass $console, thanks @mattstauffer!

@mattstauffer
Copy link
Member

Thanks @benholmen!

@mattstauffer mattstauffer merged commit 90ab981 into tighten:main Apr 3, 2021
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.

2 participants