HBASE-14119 Show error message instead of stack traces in hbase shell commands. (Apekshit)
This commit is contained in:
parent
0f614a1c44
commit
7ce318dd3b
|
@ -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|
|
||||
|
|
Loading…
Reference in New Issue