Julia: Throw a `CalledProcessError` not a `ErrorException` when `run` gives a nonzero exit status

Created on 13 Feb 2018  路  3Comments  路  Source: JuliaLang/julia

When running a command returns a non-zero exit status,
currently the error function is called, which throws an ErrorException:

https://github.com/JuliaLang/julia/blob/f9f11a3102042d53de04ef48a83c713467bbd241/base/process.jl#L693

That is not great. It is not a very nice exception to catch since the type doesn't tell us anything about the cause.

I am of the belief that error should not be being uses in Base/stdlib or indeed even in packages (past the prototyping stage).
It is a convenience to users, and should be used in hacky little scripts,
without error handling, where to error means to crash out.

Lets throw a real error.
Python uses CalledProcessError.
That is as good a name as any.

error handling

Most helpful comment

馃毑馃彋: SubprocessError

All 3 comments

馃毑馃彋: SubprocessError

SubprocessError is a good name. +1

Was this page helpful?
0 / 5 - 0 ratings