hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mberto...@apache.org
Subject [1/4] hbase git commit: HBASE-14119 Show error message instead of stack traces in hbase shell commands. (Apekshit)
Date Mon, 20 Jul 2015 22:51:56 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 12e7153ba -> 42a0b74cb
  refs/heads/branch-1.1 cd4668b3e -> 349a65d0d
  refs/heads/branch-1.2 e10585bec -> 6e558816c
  refs/heads/master 0f614a1c4 -> 7ce318dd3


HBASE-14119 Show error message instead of stack traces in hbase shell commands. (Apekshit)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/7ce318dd
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/7ce318dd
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/7ce318dd

Branch: refs/heads/master
Commit: 7ce318dd3be9df0ee1c025b4792ded0161aa2c9c
Parents: 0f614a1
Author: Apekshit(Appy) Sharma <appy@cloudera.com>
Authored: Thu Jul 16 16:54:51 2015 -0700
Committer: Matteo Bertozzi <matteo.bertozzi@cloudera.com>
Committed: Mon Jul 20 15:45:49 2015 -0700

----------------------------------------------------------------------
 hbase-shell/src/main/ruby/shell/commands.rb | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/7ce318dd/hbase-shell/src/main/ruby/shell/commands.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands.rb b/hbase-shell/src/main/ruby/shell/commands.rb
index 2abccdd..4ad04cd 100644
--- a/hbase-shell/src/main/ruby/shell/commands.rb
+++ b/hbase-shell/src/main/ruby/shell/commands.rb
@@ -98,10 +98,11 @@ module Shell
       def translate_hbase_exceptions(*args)
         yield
       rescue => e
+        # Since exceptions will be thrown from the java code, 'e' will always be NativeException.
+        # Check for the original java exception and use it if present.
         raise e unless e.respond_to?(:cause) && e.cause != nil
-
-        # Get the special java exception which will be handled
         cause = e.cause
+
          # let individual command handle exceptions first
         if self.respond_to?(:handle_exceptions)
           self.handle_exceptions(cause, *args)
@@ -110,6 +111,15 @@ module Shell
         if cause.kind_of?(org.apache.hadoop.hbase.TableNotFoundException) then
           raise "Unknown table #{args.first}!"
         end
+        if cause.kind_of?(org.apache.hadoop.hbase.UnknownRegionException) then
+          raise "Unknown region #{args.first}!"
+        end
+        if cause.kind_of?(org.apache.hadoop.hbase.NamespaceNotFoundException) then
+          raise "Unknown namespace #{args.first}!"
+        end
+        if cause.kind_of?(org.apache.hadoop.hbase.snapshot.SnapshotDoesNotExistException)
then
+          raise "Unknown snapshot #{args.first}!"
+        end
         if cause.kind_of?(org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException)
then
           exceptions = cause.getCauses
           exceptions.each do |exception|


Mime
View raw message