Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Introduce signaled process specific exception class #25775

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

Merged
merged 1 commit into from
Jan 23, 2018

Conversation

soullivaneuh
Copy link
Contributor

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #25768
License MIT
Doc PR N/A

Introduced the ProcessSignaledException class to properly catch signaled process errors.

I took benefit to refactor process exception with a new ProcessRuntimeException class.

@soullivaneuh
Copy link
Contributor Author

soullivaneuh commented Jan 12, 2018

The failing job does not seem to be related to my PR: https://travis-ci.org/symfony/symfony/jobs/328083230#L3297

class ProcessRuntimeException extends RuntimeException
{
/**
* @var Process
Copy link
Member

Choose a reason for hiding this comment

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

Do we need these PHPdoc now that we use type hints and return types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably not, indeed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, I maybe spoke to fast. The PHPdoc is for the property, not the constructor.

It could be remove from getProcess indeed, but I don't know for this one.

Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove it, the constructor already determines the type of this property. Your IDE will be able to detect this.

@soullivaneuh soullivaneuh force-pushed the signaled-process-exception branch 2 times, most recently from 5ff9574 to 21f8ac0 Compare January 12, 2018 14:22
@nicolas-grekas nicolas-grekas added this to the 4.1 milestone Jan 16, 2018
/**
* @author Sullivan Senechal <soullivaneuh@gmail.com>
*/
class ProcessRuntimeException extends RuntimeException
Copy link
Member

@nicolas-grekas nicolas-grekas Jan 16, 2018

Choose a reason for hiding this comment

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

does this intermediate class make sense in terms of exception hierarchy?
I'm not sure it does - let's use a trait instead? (it should be @internal)

Copy link
Member

Choose a reason for hiding this comment

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

or even nothing at all, as the only shared code is the getProcess method, which has no business logic. Importing the trait would be almost as big as writing the getter.

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 did this to avoid code duplicate. But right, I'll revert this part.

@soullivaneuh soullivaneuh force-pushed the signaled-process-exception branch 2 times, most recently from 2b2cc07 to b899f51 Compare January 17, 2018 11:43
@soullivaneuh
Copy link
Contributor Author

@nicolas-grekas @stof I did the changes you requested.

{
$this->process = $process;

parent::__construct(sprintf(
Copy link
Member

Choose a reason for hiding this comment

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

Can you please put this call on one line? That's our CS :)

@soullivaneuh soullivaneuh force-pushed the signaled-process-exception branch from b899f51 to a8681e9 Compare January 22, 2018 13:45
@soullivaneuh
Copy link
Contributor Author

@nicolas-grekas done.

parent::__construct(sprintf('The process has been signaled with signal "%s".', $process->getTermSignal()));
}

public function getProcess()
Copy link
Member

Choose a reason for hiding this comment

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

missing return type, isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, I did a copy/paste from ProcessFailedException for that.

Plus, see this comment: #25775 (review)

I'm not sure I have to add it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or maybe are you talking about PHP7 return type?

Copy link
Member

Choose a reason for hiding this comment

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

yes, I mean public function getProcess(): Process, sorry for the confusion

@soullivaneuh
Copy link
Contributor Author

@nicolas-grekas Code updated.

@soullivaneuh soullivaneuh force-pushed the signaled-process-exception branch from a8681e9 to 18e7f43 Compare January 22, 2018 16:26
@soullivaneuh soullivaneuh force-pushed the signaled-process-exception branch from 18e7f43 to 68adb3b Compare January 22, 2018 16:26
@fabpot
Copy link
Member

fabpot commented Jan 23, 2018

Thank you @soullivaneuh.

@fabpot fabpot merged commit 68adb3b into symfony:master Jan 23, 2018
fabpot added a commit that referenced this pull request Jan 23, 2018
…oullivaneuh)

This PR was merged into the 4.1-dev branch.

Discussion
----------

Introduce signaled process specific exception class

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #25768
| License       | MIT
| Doc PR        | N/A

Introduced the `ProcessSignaledException` class to properly catch signaled process errors.

I took benefit to refactor process exception with a new `ProcessRuntimeException` class.

Commits
-------

68adb3b Introduce signaled process specific exception class
@soullivaneuh soullivaneuh deleted the signaled-process-exception branch January 23, 2018 09:36
@soullivaneuh
Copy link
Contributor Author

You are very welcomed @fabpot! 😉

@fabpot fabpot mentioned this pull request May 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.