FELIX-2446 eclose whole gosh_profile in try {} block to stop errors from aborting startup


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@957718 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/gogo/shell/src/main/resources/gosh_profile b/gogo/shell/src/main/resources/gosh_profile
index 2440d94..aafd3cf 100644
--- a/gogo/shell/src/main/resources/gosh_profile
+++ b/gogo/shell/src/main/resources/gosh_profile
@@ -2,34 +2,38 @@
 # only read if etc/gosh_profile doesn't exist relative to the System property
 # gosh.home or failing that the current directory.
 
-# ensure gogo commands are found first
-SCOPE = gogo:*
-
-# add methods on BundleContext object as commands
-#addcommand context ${.context} (${.context} class)
-# bug: above invokes (String, Object, String) instead of (String, Object, Class)
-addcommand context ${.context}
-
-# add methods on System object as commands
-addcommand system ((context:bundle 0) loadclass java.lang.System)
-
-# alias to print full stack trace
-e = { $exception printStackTrace }
-
-## disable console auto-formatting of each result
-#  you will then need to explicitly use the 'format' command
-#  to print the result of commands that don't write to stdout.
-#.Gogo.format = false
-
-## disable printing the formatted result of a command into pipelines
-#.Format.Pipe = false
-
-# set prompt
-prompt = 'g! '
-
-# print welcome message
+# catch all exceptions from this script to avoid it aborting startup
 try {
+
+  # ensure gogo commands are found first
+  SCOPE = gogo:*
+
+  # add methods on BundleContext object as commands
+  #addcommand context ${.context} (${.context} class)
+  # bug: above invokes (String, Object, String) instead of (String, Object, Class)
+  addcommand context ${.context}
+
+  # add methods on System object as commands
+  addcommand system ((${.context} bundle 0) loadclass java.lang.System)
+
+  # alias to print full stack trace
+  e = { $exception printStackTrace }
+
+  ## disable console auto-formatting of each result
+  #  you will then need to explicitly use the 'format' command
+  #  to print the result of commands that don't write to stdout.
+  #.Gogo.format = false
+
+  ## disable printing the formatted result of a command into pipelines
+  #.Format.Pipe = false
+
+  # set prompt
+  prompt = 'g! '
+
+  # print welcome message
   cat ($0 resolve motd)
+} {
+    echo "$0: ERROR: $exception"
 }
 
 # end