Skip to content

Commit

Permalink
Added exception handling for creating directory in package command
Browse files Browse the repository at this point in the history
  • Loading branch information
Bajger committed Jan 17, 2024
1 parent e3f5848 commit 826b279
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/PharoLauncher-CLI/PhLImagePackageCliCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ PhLImagePackageCliCommand >> createDirectoryForImageToPack [
|aPath|
aPath := self location , '/' , self image name.
(self directoryAlreadyExists: aPath) ifTrue: [self raiseDirectoryAlreadyExists: aPath].
^ aPath asFileReference ensureCreateDirectory
^ [aPath asFileReference ensureCreateDirectory]
on: PrimitiveFailed
do: [ self raiseCannotCreateDirectory: self location]
]

{ #category : #private }
Expand Down Expand Up @@ -208,6 +210,12 @@ PhLImagePackageCliCommand >> location [
^ self positional: #location
]

{ #category : #'error signalling' }
PhLImagePackageCliCommand >> raiseCannotCreateDirectory: aPath [

^PhLCommandError signal: ('Cannot write to target directory: ''{1}'', please check write permissions.' format: { aPath })
]

{ #category : #'error signalling' }
PhLImagePackageCliCommand >> raiseDirectoryAlreadyExists: aPath [

Expand Down

0 comments on commit 826b279

Please sign in to comment.