Skip to content

Commit

Permalink
Merge pull request #1360 from martenson/raise-specific-exception
Browse files Browse the repository at this point in the history
[15.10] datalibs: raise and show specific exception and warning when no files detected
  • Loading branch information
jmchilton committed Dec 17, 2015
2 parents 1b3ee81 + b4683fb commit 2d7c201
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,11 @@ var FolderToolbarView = Backbone.View.extend({
},
error: function(model, response){
if (typeof response.responseJSON !== "undefined"){
mod_toastr.error(response.responseJSON.err_msg);
if (response.responseJSON.err_code === 404001){
mod_toastr.warning(response.responseJSON.err_msg);
} else{
mod_toastr.error(response.responseJSON.err_msg);
}
} else {
mod_toastr.error('An error ocurred.');
}
Expand Down
4 changes: 4 additions & 0 deletions lib/galaxy/webapps/galaxy/api/remote_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def index( self, trans, **kwd ):
if user_base_dir is None:
raise exceptions.ConfigDoesNotAllowException( 'The configuration of this Galaxy instance does not allow upload from user directories.' )
full_import_dir = os.path.join( user_base_dir, user_login )
if not os.path.exists(full_import_dir):
raise exceptions.ObjectNotFound('You do not have any files in your user directory. Use FTP to upload there.')
if full_import_dir is not None:
if format == 'jstree':
disable = kwd.get( 'disable', 'folders')
Expand All @@ -51,6 +53,8 @@ def index( self, trans, **kwd ):
except Exception, exception:
log.debug( str( exception ) )
raise exceptions.InternalServerError( 'Could not create tree representation of the given folder: ' + str( full_import_dir ) )
if not response:
raise exceptions.ObjectNotFound('You do not have any files in your user directory. Use FTP to upload there.')
elif format == 'ajax':
raise exceptions.NotImplemented( 'Not implemented yet. Sorry.' )
else:
Expand Down
Loading

0 comments on commit 2d7c201

Please sign in to comment.