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

add PipelineError to capture exit code #26722

Closed
wants to merge 2 commits into from
Closed

Conversation

simonbyrne
Copy link
Contributor

@simonbyrne simonbyrne commented Apr 5, 2018

At the moment if a process fails and throws and error, there is no easy way to capture the exit code. The only other option is to run asynchronously and manually check (but then there is no easy way to throw an error...)

@simonbyrne
Copy link
Contributor Author

Alternative to #26719

@simonbyrne simonbyrne added the triage This should be discussed on a triage call label Apr 5, 2018
error("Downloading files requires Windows Management Framework 3.0 or later.")
end
rethrow(e)
end
Copy link
Member

Choose a reason for hiding this comment

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

This should probably be a separate commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same PR okay?

Copy link
Member

Choose a reason for hiding this comment

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

Sure.

Copy link
Member

Choose a reason for hiding this comment

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

On the triage call it was noted that we might not want to actually use this style of error handling --- we can use wait=false, call wait on the process object, and then look at the exit code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In that case, should we export pipeline_error (or some sort of "throw error based on exit code" function?)

@@ -707,29 +707,38 @@ with a code of 0). An exception is raised if the process cannot be started.
"""
success(cmd::AbstractCmd) = success(_spawn(cmd))

struct PipelineError{P} <: Exception
Copy link
Member

Choose a reason for hiding this comment

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

Maybe call it ProcessError since it has to do with process failure, and there is not necessarily a pipeline (might be 1 process)?

@StefanKarpinski
Copy link
Member

Some bikeshedding: this could be called ProcessError since there's always some process that failed, and it's not always wrapping a pipeline. Maybe this structure:

struct ProcessError <: Exception
    process::Process
    pipeline::Union{Nothing,Pipeline}
end

Where the process is the process that failed and pipeline is the pipeline that it belonged to, if any.

@StefanKarpinski
Copy link
Member

Triage is in favor of the better error type; @vtjnash doesn't want to use it for this particular use case, favoring a run(..., wait=false) call with a status check instead.

@StefanKarpinski StefanKarpinski removed the triage This should be discussed on a triage call label Apr 5, 2018
@StefanKarpinski StefanKarpinski added this to the 1.0 milestone Apr 5, 2018
@simonbyrne
Copy link
Contributor Author

@vtjnash doesn't want to use it for this particular use case, favoring a run(..., wait=false) call with a status check instead.

So similar to #26719?

@simonbyrne
Copy link
Contributor Author

Can't you have multiple failures in the one pipeline?

@StefanKarpinski
Copy link
Member

Can't you have multiple failures in the one pipeline?

Sure, that's why it has the pipeline field as well.

@simonbyrne
Copy link
Contributor Author

Okay, but which one do we report in the process field?

@StefanKarpinski
Copy link
Member

The first one that failed, presumably.

@JeffBezanson JeffBezanson removed this from the 1.0 milestone Apr 10, 2018
@JeffBezanson
Copy link
Member

This can still be done but doesn't block 1.0.

@simonbyrne
Copy link
Contributor Author

Looks like it was fixed by #27900

@simonbyrne simonbyrne closed this Feb 13, 2023
@simonbyrne simonbyrne deleted the sb/pipelineerror branch February 13, 2023 17:33
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