From 81a331a3eaf81352b0f06a7b91f9ced73be04741 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 28 Sep 2005 15:26:44 +0000 Subject: 21779 plus unposted catch change: exception improvementss --- Functions/Exceptions/catch | 2 +- Functions/Exceptions/throw | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'Functions') 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 -- cgit 1.4.1