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

mkdir: supply path to SystemError #14015

Merged
merged 1 commit into from
Nov 17, 2015
Merged

mkdir: supply path to SystemError #14015

merged 1 commit into from
Nov 17, 2015

Conversation

timholy
Copy link
Member

@timholy timholy commented Nov 16, 2015

Some mkdir errors are very hard to debug unless you know what path it was trying to create. For example:

INFO: Upgrading Escher: v0.1.0 => v0.2.1
INFO: Upgrading Mux: v0.1.1 => v0.2.0
INFO: Installing Plots v0.4.2
INFO: Removing Color v0.2.11
INFO: Rolling back install of Plots
INFO: Rolling back Mux from v0.2.0 to v0.1.1
INFO: Rolling back Escher from v0.2.1 to v0.1.0
ERROR: SystemError: mkdir: File exists
 in mkdir at file.jl:42
 in cptree at file.jl:100
 in cp at file.jl:120
 in rename at fs.jl:121
 in remove at pkg/write.jl:50
 in resolve at ./pkg/entry.jl:459
 in resolve at pkg/entry.jl:404
 in anonymous at pkg/entry.jl:198
 in transact at pkg/git.jl:97
 in _checkout at pkg/entry.jl:190
 in free at pkg/entry.jl:220
 in anonymous at pkg/dir.jl:31
 in cd at file.jl:22
 in cd at pkg/dir.jl:31
 in free at pkg.jl:40

The problem turned out to be a symlink ~/.julia/v0.4/.trash/Color (I was using symlinks to facilitate testing changes on both 0.3 and 0.4), but until I modified the error to show the path this was difficult to figure out.

The new version prints something like this:

"SystemError (with /home/tim/.julia/v0.4/.trash/Color): mkdir: File exists"

Some mkdir errors are very hard to debug unless you know what path it was trying to create.
timholy added a commit that referenced this pull request Nov 17, 2015
mkdir: supply path to SystemError
@timholy timholy merged commit 8c23dc8 into master Nov 17, 2015
@timholy timholy deleted the teh/systemerror branch November 17, 2015 02:21
@tkelman
Copy link
Contributor

tkelman commented Nov 17, 2015

The keyword argument should be documented here.

@tkelman tkelman added the error handling Handling of exceptions by Julia or the user label Dec 2, 2015
@tkelman
Copy link
Contributor

tkelman commented Dec 2, 2015

Oh hah, I was having a hard time debugging something for exactly this reason (on release-0.4 though). Why did you go with a keyword argument instead of constructing the message as the first input to systemerror ? We could use similar treatments for most other operations that can throw SystemErrors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error handling Handling of exceptions by Julia or the user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants