From ccdd2fd2ca86b355dd67466bb17ba00615ff0928 Mon Sep 17 00:00:00 2001 From: Anis Kadri Date: Mon, 5 Nov 2012 17:51:32 -0800 Subject: [PATCH] CB-1809 `create` script should print out meaningful error messages --- bin/create | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/create b/bin/create index 71b912bb..1bce739e 100755 --- a/bin/create +++ b/bin/create @@ -66,12 +66,14 @@ function createAppInfoJar { } function on_error { - echo "An error occurred. Deleting project..." + echo "An unexpected error occurred: $previous_command exited with $?" + echo "Deleting project..." [ -d "$PROJECT_PATH" ] && rm -rf "$PROJECT_PATH" + exit "$?" } function replace { - local pattern=$1 + local pattern=$1 local filename=$2 # Mac OS X requires -i argument if [[ "$OSTYPE" =~ "darwin" ]] @@ -84,6 +86,7 @@ function replace { } # we do not want the script to silently fail +trap 'previous_command=$this_command; this_command=$BASH_COMMAND' DEBUG trap on_error ERR trap on_exit EXIT