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

Catch exceptions inside «cd» func #1480

Closed
staabm opened this issue Dec 27, 2017 · 2 comments · Fixed by #1519
Closed

Catch exceptions inside «cd» func #1480

staabm opened this issue Dec 27, 2017 · 2 comments · Fixed by #1519
Labels
Milestone

Comments

@staabm
Copy link
Contributor

staabm commented Dec 27, 2017

Q A
Issue Type Feature Request
Deployer Version 6.0.3
Local Machine OS N/A
Remote Machine OS N/A

With a task like

task('clx:remote_dirty', function() {
    cd('{{current_path}}');
    $output = run('svn status');

    if (!empty($output)) {
        throw new \Exception("Remote working copy contains uncommitted changes!\n". $output);
    }
});

you can run into errors like

 [Deployer\Exception\RuntimeException (1)]
  The command "readlink /www/apps/relaunch/current" failed.
  Exit Code: 1 (General error)
  Host Name: ci16
  ================

in the error message it mentions a path, which was not mentioned in the recipe.
IMO the error message should also contain a hint to the line of the recipe, in this case cd('{{current_path}}');. otherwise the user of deployer needs to know the internals of deployer to find the actual line throwing/generating the error

@staabm
Copy link
Contributor Author

staabm commented Dec 27, 2017

also a visual hint inside the stacktrace would be helpfull:

grafik

as a user you get a rather large stacktrace, but most of the time the offending line from your recipe is hidden in between

@antonmedv
Copy link
Member

Reading stack trace is difficult for users. It's try. My be it's better to handle error inside cd and re throw errors.

@antonmedv antonmedv added this to the 7.0 milestone Dec 27, 2017
@antonmedv antonmedv changed the title error messages contain expanded path, missing relation to the origin code Catch exceptions inside «cd» func Dec 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants