about summary refs log tree commit diff
path: root/Functions
diff options
context:
space:
mode:
Diffstat (limited to 'Functions')
-rw-r--r--Functions/Exceptions/catch2
-rw-r--r--Functions/Exceptions/throw5
2 files changed, 4 insertions, 3 deletions
diff --git a/Functions/Exceptions/catch b/Functions/Exceptions/catch
index 5f3876228..6afd664da 100644
--- a/Functions/Exceptions/catch
+++ b/Functions/Exceptions/catch
@@ -28,7 +28,7 @@
 function catch {
   if [[ $TRY_BLOCK_ERROR -gt 0 && $EXCEPTION = ${~1} ]]; then
     (( TRY_BLOCK_ERROR = 0 ))
-    CAUGHT="$EXCEPTION"
+    typeset -g CAUGHT="$EXCEPTION"
     unset EXCEPTION
     return 0
   fi
diff --git a/Functions/Exceptions/throw b/Functions/Exceptions/throw
index a5478fb9c..5c7326999 100644
--- a/Functions/Exceptions/throw
+++ b/Functions/Exceptions/throw
@@ -19,11 +19,12 @@
 # script.
 
 # The following must not be local.
-EXCEPTION="$1"
+typeset -g EXCEPTION="$1"
+readonly THROW
 if (( TRY_BLOCK_ERROR == 0 )); then
   # We are throwing an exception from the middle of an always-block.
   # We can do this by restoring the error status from the try-block.
   (( TRY_BLOCK_ERROR = 1 ))
 fi
 # Raise an error, but don't show an error message.
-{ ${:?THROW} } 2>/dev/null
+THROW= 2>/dev/null