[gimp-macos-build/wip/lukaso/tests] try block around error



commit 5545abe3f192826f53e6c3985ce63390b20a74ee
Author: Lukas Oberhuber <lukaso gmail com>
Date:   Sun Oct 17 21:18:47 2021 +0100

    try block around error

 package/create-dmg/support/template.applescript | 142 ++++++++++++------------
 1 file changed, 73 insertions(+), 69 deletions(-)
---
diff --git a/package/create-dmg/support/template.applescript b/package/create-dmg/support/template.applescript
index bd91067..46231d1 100644
--- a/package/create-dmg/support/template.applescript
+++ b/package/create-dmg/support/template.applescript
@@ -1,84 +1,88 @@
 on run (volumeName)
        tell application "Finder"
                log "diskname " & volumeName
-               tell disk (volumeName as string)
-                       log "2"
-                       open
-                       log "3"
+               try
+                       tell disk (volumeName as string)
+                               log "2"
+                               open
+                               log "3"
 
-                       set theXOrigin to WINX
-                       set theYOrigin to WINY
-                       set theWidth to WINW
-                       set theHeight to WINH
-                       log "4"
+                               set theXOrigin to WINX
+                               set theYOrigin to WINY
+                               set theWidth to WINW
+                               set theHeight to WINH
+                               log "4"
 
-                       set theBottomRightX to (theXOrigin + theWidth)
-                       set theBottomRightY to (theYOrigin + theHeight)
-                       set dsStore to "\"" & "/Volumes/" & volumeName & "/" & ".DS_STORE\""
-                       log "5"
+                               set theBottomRightX to (theXOrigin + theWidth)
+                               set theBottomRightY to (theYOrigin + theHeight)
+                               set dsStore to "\"" & "/Volumes/" & volumeName & "/" & ".DS_STORE\""
+                               log "5"
 
-                       tell container window
-                               log "6"
-                               set current view to icon view
-                               log "7"
-                               set toolbar visible to false
-                               log "8"
-                               set statusbar visible to false
-                               log "9"
-                               set the bounds to {theXOrigin, theYOrigin, theBottomRightX, theBottomRightY}
-                               log "10"
-                               set statusbar visible to false
-                               log "11"
-                               REPOSITION_HIDDEN_FILES_CLAUSE
-                               log "12"
-                       end tell
-                       log "13"
+                               tell container window
+                                       log "6"
+                                       set current view to icon view
+                                       log "7"
+                                       set toolbar visible to false
+                                       log "8"
+                                       set statusbar visible to false
+                                       log "9"
+                                       set the bounds to {theXOrigin, theYOrigin, theBottomRightX, 
theBottomRightY}
+                                       log "10"
+                                       set statusbar visible to false
+                                       log "11"
+                                       REPOSITION_HIDDEN_FILES_CLAUSE
+                                       log "12"
+                               end tell
+                               log "13"
 
-                       set opts to the icon view options of container window
-                       log "14"
-                       tell opts
-                               log "15"
-                               set icon size to ICON_SIZE
-                               log "16"
-                               set text size to TEXT_SIZE
-                               log "17"
-                               set arrangement to not arranged
-                               log "18"
-                       end tell
-                       log "19"
-                       BACKGROUND_CLAUSE
-                       log "20"
+                               set opts to the icon view options of container window
+                               log "14"
+                               tell opts
+                                       log "15"
+                                       set icon size to ICON_SIZE
+                                       log "16"
+                                       set text size to TEXT_SIZE
+                                       log "17"
+                                       set arrangement to not arranged
+                                       log "18"
+                               end tell
+                               log "19"
+                               BACKGROUND_CLAUSE
+                               log "20"
 
-                       -- Positioning
-                       POSITION_CLAUSE
-                       log "21"
+                               -- Positioning
+                               POSITION_CLAUSE
+                               log "21"
 
-                       -- Hiding
-                       HIDING_CLAUSE
-                       log "22"
+                               -- Hiding
+                               HIDING_CLAUSE
+                               log "22"
 
-                       -- Application and QL Link Clauses
-                       APPLICATION_CLAUSE
-                       log "23"
-                       QL_CLAUSE
-                       log "24"
-                       close
-                       log "25"
-                       open
-                       log "26"
-                       -- Force saving of the size
-                       delay 1
-                       log "27"
+                               -- Application and QL Link Clauses
+                               APPLICATION_CLAUSE
+                               log "23"
+                               QL_CLAUSE
+                               log "24"
+                               close
+                               log "25"
+                               open
+                               log "26"
+                               -- Force saving of the size
+                               delay 1
+                               log "27"
 
-                       tell container window
-                               log "28"
-                               set statusbar visible to false
-                               log "29"
-                               set the bounds to {theXOrigin, theYOrigin, theBottomRightX - 10, 
theBottomRightY - 10}
-                               log "30"
+                               tell container window
+                                       log "28"
+                                       set statusbar visible to false
+                                       log "29"
+                                       set the bounds to {theXOrigin, theYOrigin, theBottomRightX - 10, 
theBottomRightY - 10}
+                                       log "30"
+                               end tell
+                               log "31"
                        end tell
-                       log "31"
-               end tell
+               on error the errorMessage number the errorNumber
+                       log "errorMessage " & errorMessage & " errorNumber " & errorNumber
+               end try
                log "32"
 
                delay 1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]