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

Script not found results in a stack track #522

lihaoyi opened this Issue Dec 9, 2016 · 0 comments


None yet
1 participant
Copy link

lihaoyi commented Dec 9, 2016

If you try and run a script that doesn't exist, it blows up with a stack trace

lihaoyi Resume$ amm Resume.
Exception in thread "main" java.nio.file.NoSuchFileException: /Users/lihaoyi/Dropbox/Workspace/Resume/Resume.
	at sun.nio.fs.UnixException.translateToIOException(
	at sun.nio.fs.UnixException.rethrowAsIOException(
	at sun.nio.fs.UnixException.rethrowAsIOException(
	at sun.nio.fs.UnixFileSystemProvider.newByteChannel(
	at java.nio.file.Files.newByteChannel(
	at java.nio.file.Files.newByteChannel(
	at java.nio.file.Files.readAllBytes(
	at ammonite.ops.Path.getBytes(Path.scala:299)
	at ammonite.main.Scripts$.runScript(Scripts.scala:24)
	at ammonite.Main.runScript(Main.scala:121)
	at ammonite.Main$$anonfun$main$1$$anonfun$apply$1.apply(Main.scala:251)
	at ammonite.Main$.ammonite$Main$$ifContinually$1(Main.scala:228)
	at ammonite.Main$$anonfun$main$1.apply(Main.scala:230)
	at ammonite.Main$$anonfun$main$1.apply(Main.scala:230)
	at scala.Option.foreach(Option.scala:257)
	at ammonite.Main$.main(Main.scala:230)

This is a pretty common error and we should hide the stack trace behind a pretty error message

@lihaoyi lihaoyi added bug easy labels Dec 9, 2016

tkroman added a commit to tkroman/Ammonite that referenced this issue Dec 10, 2016

@lihaoyi lihaoyi closed this in da49f94 May 12, 2017

jhnsmth added a commit to jhnsmth/Ammonite that referenced this issue May 21, 2017

- Fix lihaoyi#522 by making us print a nice error message when we can…
…'t read the file

- Make `Path(s: String)` resolve `~` to mean the home directory of the current user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.