pharo-project / pharo-launcher

Lets you manage your pharo images and download new ones
https://pharo-project.github.io/pharo-launcher/
MIT License
109 stars 46 forks source link

Image packaging from CLI throws unhandled exception when path targets directory without write permission #640

Closed Bajger closed 10 months ago

Bajger commented 10 months ago

Describe the bug Unhandled exception during packaging image

To Reproduce Steps to reproduce the behavior:

  1. Execute e.g. (or directory with no write permission): ./pharo-launcher image package newImage /home/tmp --zip
  2. See error:
    PrimitiveFailed: primitive #createDirectory: in UnixStore failed
    UnixStore(ProtoObject)>>primitiveFailed:
    UnixStore(ProtoObject)>>primitiveFailed
    UnixStore(DiskStore)>>createDirectory:
    UnixStore(FileSystemStore)>>ensureCreateDirectory:
    UnixStore(FileSystemStore)>>ensureCreateDirectory:
    FileSystem>>ensureCreateDirectory:
    FileReference>>ensureCreateDirectory
    PhLImagePackageCliCommand>>createDirectoryForImageToPack
    PhLImagePackageCliCommand>>basicExecute
    [ self basicExecute ] in PhLImagePackageCliCommand(PhLCliCommand)>>execute in Block: [ self basicExecute ]
    FullBlockClosure(BlockClosure)>>on:do:
    PhLImagePackageCliCommand(PhLCliCommand)>>execute
    PhLImagePackageCliCommand(ClapApplication)>>executeOrPrintHelp
    ...

Expected behavior User-friendly message is shown to user: "Cannot write to target directory . Please check write permissions."

Version information:

Expected development cost Add handing of exception to: PhLImagePackageCliCommand>>createDirectoryForImageToPack

demarey commented 10 months ago

Also, for error handlng, probably Pharo Lzuncher CLI should handle all exceptions to only provide the error message and not the full stack (with an option to display the full stack)