summary refs log tree commit diff
path: root/Functions/Exceptions
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-09-28 15:26:44 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-09-28 15:26:44 +0000
commit81a331a3eaf81352b0f06a7b91f9ced73be04741 (patch)
tree62c9229d625c27e267441961d229bf8047792b27 /Functions/Exceptions
parentc3ca181fbe299b0f61885cc591fd7e1c01aee8f1 (diff)
downloadzsh-81a331a3eaf81352b0f06a7b91f9ced73be04741.tar.gz
zsh-81a331a3eaf81352b0f06a7b91f9ced73be04741.tar.xz
zsh-81a331a3eaf81352b0f06a7b91f9ced73be04741.zip
21779 plus unposted catch change: exception improvementss
Diffstat (limited to 'Functions/Exceptions')
-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