From c324f3096fb26eb0fdea6eaf963366efa6be186c Mon Sep 17 00:00:00 2001 From: Jing Zhao Date: Fri, 21 Feb 2014 18:57:06 +0000 Subject: [PATCH] HDFS-5935. New Namenode UI FS browser should throw smarter error messages. Cotributed by Travis Thompson. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1570663 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../src/main/webapps/hdfs/explorer.js | 21 +++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 1bc4c74299..acc6e4df85 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -424,6 +424,9 @@ Release 2.4.0 - UNRELEASED HDFS-5775. Consolidate the code for serialization in CacheManager (Haohui Mai via brandonli) + HDFS-5935. New Namenode UI FS browser should throw smarter error messages. + (Travis Thompson via jing9) + OPTIMIZATIONS HDFS-5790. LeaseManager.findPath is very slow when many leases need recovery diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js index 5d802104ff..bcce8c16b1 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js @@ -66,10 +66,23 @@ function network_error_handler(url) { return function (jqxhr, text, err) { - var msg = '

Failed to retreive data from ' + url + ', cause: ' + err + '

'; - if (url.indexOf('/webhdfs/v1') === 0) { - msg += '

WebHDFS might be disabled. WebHDFS is required to browse the filesystem.

'; - } + switch(jqxhr.status) { + case 401: + var msg = '

Authentication failed when trying to open ' + url + ': Unauthrozied.

'; + break; + case 403: + if(jqxhr.responseJSON !== undefined && jqxhr.responseJSON.RemoteException !== undefined) { + var msg = '

' + jqxhr.responseJSON.RemoteException.message + "

"; + break; + } + var msg = '

Permission denied when trying to open ' + url + ': ' + err + '

'; + break; + case 404: + var msg = '

Path does not exist on HDFS or WebHDFS is disabled. Please check your path or enable WebHDFS

'; + break; + default: + var msg = '

Failed to retreive data from ' + url + ': ' + err + '

'; + } show_err_msg(msg); }; }